build(configure): enable more sanitizers for --enable-sanitize - #892
build(configure): enable more sanitizers for --enable-sanitize#892tueda wants to merge 1 commit into
Conversation
|
Maybe the CI should also run the test suite with sanitizers enabled? Adding FORMapart tests will slow the CI down a lot, removing the -w2 tests after Ana's PR is ready will speed it up again. |
This sounds good, but to replace (most of) Valgrind Memcheck's functionality, we also need to set up MemorySanitizer to detect uninitialised memory use (this is a very powerful check for FORM, as you know). This requires the dependent libraries (GMP, ..., FLINT) to be built with MemorySanitizer as well. Once this is done, we can run separate CI jobs with |
|
...and I get many failures in the test suite if the sanitiser is enabled, particularly with I haven't checked all the failures, but what I can say for now is that I wasn't aware that pointer arithmetic outside an object's bounds (except one past the end) is undefined behaviour, even without dereferencing it. This makes some sense for non-flat address spaces, but such address arithmetic shouldn't be a problem on modern hardware. Simple exampleUndefined behaviour here (according to C23 draft N3096 §6.5.6 ¶9): Line 623 in 82407dd The compiler is then free to do anything, summon nasal demons, or delete all your files. |
At least for now, I would suggest to keep the valgrind tests in addition. |
|
So if I understand correctly, that needs to be something like |
With this PR,
--enable-sanitizeleads to-fsanitize=address,pointer-compare,pointer-subtract,undefined,bounds-strict,float-divide-by-zero,float-cast-overflowon supported compilers.For example,
ASAN_OPTIONS=detect_invalid_pointer_pairs=2 /path/to/vorm test.frmreports the following error for the example in #866: