This is pretty cool, agreed that it would be worthwhile to have
support for this.

How does ubsan work in native world? E.g. are there special flags that
LLVM/Clang need to be built with to enable it? Or does it always come
with this support enabled? Are there other flags that one would have
besides -fsanitize=signed-integer-overflow?

2017-10-18 2:07 GMT+03:00 Charles Vaughn <[email protected]>:
> Mocked up a quick PoC to test whether LLVM's ubsan would work with
> Emscripten.
>
> You can find it here:
> https://gist.github.com/hackcasual/7de2f357714505061506df01923f99cd
>
> Compile and run like so:
>
> c:\dev>em++  testub.cc -fsanitize=signed-integer-overflow && node a.out.js
> Overflow happened 2147483647 + 1 @testub.cc
>
> em++ doesn't seem to hook up the ubsan library, and a cursory investigation
> of it in the LLVM source leads me to believe it might be challenging to get
> working with Emscripten. Turning it on for my large, private code base
> (~10MB js for the test suite) showed less than 10 methods needing to be
> defined, so it's probably easier to re-implement the runtime library
> specifically for emscripten. This would also allow for stuff like debugger
> on UB, or printing Javascript stack traces. For full ubsan support, the
> JSBackend would need to implement the @llvm.objectsize intrinsic, but I
> believe only -fsanitize=object-size depends on it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to