This diff enables address sanitizer on Emscripten.
On Emscripten, real memory starts at the value passed to --global-base.
All memory before this is used as shadow memory, and thus the shadow mapping
function is simply dividing by 8.
Paths
| Differential D63742
[WebAssembly] Implement Address Sanitizer for Emscripten ClosedPublic Authored by quantum on Jun 24 2019, 3:45 PM.
Details Summary This diff enables address sanitizer on Emscripten. On Emscripten, real memory starts at the value passed to --global-base. All memory before this is used as shadow memory, and thus the shadow mapping
Diff Detail
Event TimelineHerald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 24 2019, 3:45 PM
Comment Actions I wonder if we should use the linux/unix convention or edata etext and end? Terrible names obviously but there is precedent. I can't remember why I didn't do that for data_end and heap_base. If not, then perhaps this should be called data_start to match the existing data_end? Of course this means that command line flag is somewhat misnamed then. Comment Actions As for the name, I think __global_base matches the command line flag and makes it more clear what controls it, so I lean towards that.
quantum mentioned this in D63833: [wasm-ld] Add __global_base symbol to mark the value of --global-base. Comment ActionsSplit wasm-ld change into D63833. Comment Actions Remember to remove "A symbol __global_base is added so that code may know where the shadow This revision is now accepted and ready to land.Jun 26 2019, 11:47 AM Closed by commit rL364468: [WebAssembly] Implement Address Sanitizer for Emscripten (authored by quantum). · Explain WhyJun 26 2019, 1:16 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 206315 clang/lib/Driver/ToolChains/WebAssembly.cpp
clang/test/Driver/wasm-toolchain.c
lld/test/wasm/global-base.ll
lld/wasm/Driver.cpp
lld/wasm/Symbols.h
lld/wasm/Symbols.cpp
lld/wasm/Writer.cpp
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
|
Surly if emscripten is passing in --global-base it already knows this value?
Otherwise lgtm. Perhaps split of the lld part into a separate change?