liboqs icon indicating copy to clipboard operation
liboqs copied to clipboard

Run clang's MemorySanitizer in CI

Open xvzcf opened this issue 2 years ago • 2 comments
trafficstars

In compiler_opts.cmake, we have the following code:

elseif(USE_SANITIZER STREQUAL "Memory")
    add_compile_options(-fsanitize=address)
    set(SANITIZER_LD_FLAGS "-fsanitize=memory")
elseif(USE_SANITIZER STREQUAL "MemoryWithOrigins")
...

I opened this issue to ask whether we should be running a memory-sanitizer build regularly to test this option.

xvzcf avatar Jan 20 '23 18:01 xvzcf

Your point is that it should be add_compile_options(-fsanitize=memory)? Yes, let's fix that.

As for running it regularly in CI, sure, if the runtime is not problematic.

dstebila avatar Jan 20 '23 18:01 dstebila

I tried running the tests with the memory sanitizer turned on after creating #1680. The build was intensive, and the tests failed very loudly. Interestingly enough there were quite a few complaints about functions in libcrypto, so some of the failures might be beyond our control. (That said, the tests also failed loudly with -DOQS_USE_OPENSSL=OFF.)

#1680 contains the one-line fix for the compile flag, so I'm going to preemptively rename this issue to clarify that it's tracking the proposed CI configuration. However, I think it will be a significant amount of work to get the memory sanitizer working in CI.

SWilson4 avatar Jan 26 '24 21:01 SWilson4