emscripten-core / emscripten-core/emscripten
AddressSanitizer doesn't work together with Asyncify (specifically, test_asyncify_lists_onlylist_d)
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Even when a simple example:
```c
#include
int main() {
emscripten_sleep(0);
}
```
is compiled with Asyncify and AddressSanitizer:
```
emcc temp.c -s ASYNCIFY -fsanitize=address -o temp.js -s ALLOW_MEMORY_GROWTH
```
it fails at runtime with some internal error:
```
$ node temp
exception thrown: RuntimeError: unreachable,RuntimeError: unreachable
at asan_c_load_4 (:wasm-function[706]:0x7fab1)
at ret. (/tmp/temp.js:4910:24)
at /tmp/temp.js:1245:20
at _asan_js_load_4 (/tmp/temp.js:573:33)
at Object.getDataRewindFunc (/tmp/temp.js:4955:12)
at Object.doRewind (/tmp/temp.js:4961:24)
at /tmp/temp.js:4986:41
at callUserCallback (/tmp/temp.js:4832:3)
at Timeout._onTimeout (/tmp/temp.js:4618:3)
at listOnTimeout (internal/timers.js:554:17)
/tmp/temp.js:86
throw ex;
^
RuntimeError: unreachable
at asan_c_load_4 (:wasm-function[706]:0x7fab1)
at ret. (/tmp/temp.js:4910:24)
at /tmp/temp.js:1245:20
at _asan_js_load_4 (/tmp/temp.js:573:33)
at Object.getDataRewindFunc (/tmp/temp.js:4955:12)
at Object.doRewind (/tmp/temp.js:4961:24)
at /tmp/temp.js:4986:41
at callUserCallback (/tmp/temp.js:4832:3)
at Timeout._onTimeout (/tmp/temp.js:4618:3)
at listOnTimeout (internal/timers.js:554:17)
```
For the same reason, all our Asyncify tests in the testsuite have ASAN disabled (otherwise they fail with the same error).
It's not ideal, as many real-world apps rely on Asyncify while also need ASAN to catch memory corruption bugs.
(previously discussed with @kripken, just creating as an issue for tracking purposes)
Contributor guide
Assessment
This issue has not been assessed yet.