Skip to content

AddressSanitizer doesn't work together with Asyncify (specifically, test_asyncify_lists_onlylist_d) #14807

Open
@RReverser

Description

@RReverser

Even when a simple example:

#include <emscripten.h>

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 (<anonymous>:wasm-function[706]:0x7fab1)
    at ret.<computed> (/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 (<anonymous>:wasm-function[706]:0x7fab1)
    at ret.<computed> (/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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions