[MDEV-30936] clang 15.0.7 -fsanitize=memory fails massively Created: 2023-03-27 Updated: 2023-03-29 Resolved: 2023-03-28 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server, Storage Engine - InnoDB |
| Affects Version/s: | 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1 |
| Fix Version/s: | 11.1.1, 10.11.3, 11.0.2, 10.5.20, 10.6.13, 10.7.8, 10.8.8, 10.9.6, 10.10.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | MSAN | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
It appears that since fairly recently, MSAN is marking memory uninitialized in destructors. Here is a simple example of something that needs to be adjusted in response to this:
All such code needs to be fixed before it is meaningful to upgrade to a newer MSAN environment on our CI systems. On my local system, for some reason, I am not getting correct diagnostics, but something like this:
The thread local symbol in question is defined in the global BSS of mariadbd. Luckily, ./mtr --rr works, and it suffices to me to set a breakpoint in __msan_warning_with_origin_noreturn to diagnose the failures, with proper stack traces in rr replay. |
| Comments |
| Comment by Marko Mäkelä [ 2023-03-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Here is a reason for some remaining failures:
This would cause an error in free_root() for comparing root->used to nullptr. I am not familiar enough with the code to say how this should be best. A possible work-around might be as follows, but it feels like an overkill:
Another work-around might be to explicitly set MSAN_OPTIONS=poison_in_dtor=0 to revert the change of the default value. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-03-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
The mystery llvm-symbolizer failures actually started with llvm-symbolizer-14, which was the first one to link dynamically to libgmp. Because we are passing an MSAN-instrumented libgmp to all binaries, also the newer llvm-symbolizer will fail to load, because we are not using a MSAN-instrumented llvm-symbolizer. In other words, the following errors indicate that the loading of dynamic libraries while starting up llvm-symbolizer failed:
The subsequent warnings are for something related to the failed popen() or whatever the instrumented code used to invoke llvm-symbolizer. The fix to this is to write a simple wrapper script that discards the environment variable LD_LIBRARY_PATH:
This script can be pointed to by the environment variable MSAN_SYMBOLIZER_PATH, to get nice stack traces for MSAN failures. I will update also |