emscripten-core / emscripten-core/emscripten

Do not define unsupported IPPROTO_SCTP

Open
#15,933 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hi! In working on CPython porting to Emscripten I discovered that `IPPROTO_SCTP` seems to be defined but when used leads to a failed assert.

My emcc -v output:
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.0 (3fd52e107187b8a169bb04a02b9f982c8a075205)
clang version 14.0.0 (https://github.com/llvm/llvm-project 4348cd42c385e71b63e5da7e492172cff6a79d7b)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/ethanhs/emsdk/upstream/bin
```

I'm afraid I don't have a small easy reproduction, but you can reporduce the assertion by cloning https://github.com/ethanhs/python-wasm and pull my PR https://github.com/python/cpython/pull/30495 to the `cpython` sub-directory. Here is the backtrace I get:

```
Aborted(Assertion failed: undefined)
exiting due to exception: RuntimeError: Aborted(Assertion failed: undefined),RuntimeError: Aborted(Assertion failed: undefined)
at abort (/home/ethanhs/python-wasm/cpython/builddir/host/python.js:1511:11)
at assert (/home/ethanhs/python-wasm/cpython/builddir/host/python.js:697:5)
at Object.createSocket (/home/ethanhs/python-wasm/cpython/builddir/host/python.js:4719:11)
at ___syscall_socket (/home/ethanhs/python-wasm/cpython/builddir/host/python.js:6643:25)
at socket (:wasm-function[8038]:0x2e72af)
at sock_initobj (:wasm-function[5651]:0x23728c)
at wrap_init (:wasm-function[3135]:0x140540)
at wrapperdescr_call (:wasm-function[468]:0x20c48)
at _PyObject_MakeTpCall (:wasm-function[2352]:0xfda86)
at PyObject_Vectorcall (:wasm-function[2360]:0xfe197)
```

which is the assert

```js
var streaming = type == 1;
if (protocol) {
assert(streaming == (protocol == 6)); // if SOCK_STREAM, must be tcp
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.