-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get the test suite passing with clang Memory Sanitizer enabled #79395
Comments
clang's memory sanitizer (-fsanitize=memory) turns up useful problems in code. I'm working on getting a CPython buildbot running it setup but would like our build to be cleaner to start with before I run that. These are the initial fixes required for most of CPython to pass in an msan build. We've been using these with our interpreters at Google. (PR coming) |
Can we prefix MEMORY_SANITIZER with _Py_? |
I cannot initialize the interpreter after compiling with --with-memory-sanitizer: ❯ CC=clang ./configure --with-memory-sanitizer && make -j Uninitialized value was created by a heap allocation SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/pablogsal/github/cpython/python+0x9a55c3) ❯ clang --version ❯ /lib/libc.so.6 I am missing something or is this expected (as there are more PRs to come)? |
All libraries that are linked against, including libc, need to be compiled with MSAN. MSAN is not for the faint of heart. |
Thanks @alex! I will try again after linking against ASAN-compiled version of my libraries. |
yeah, i've been surprised how far i was able to get from an oss CPython tree and pre-built clang 7 binary installation. If you have headers installed for common libraries like libssl-dev and libreadline-dev you can't produce an interpreter that'll work as those both lead to quick crashes. also, in my experience optimized builds tend to be more problematic (too early to say if what i'm seeing are actual problems). also, make sure llvm-symbolize (no suffixes) is in your path for it to auto-symbolize the traces showing you where in the code it pointed out issues. when it points within shared libraries instead of the Python source tree - that's a hint that the library probably may need msan compilation. I'm plodding through things to see if I can get a _useful_ buildbot setup (i don't care of some extension modules can't be covered for now) out of all of this. |
Yes, I wondered if I should do that. not that I expect anyone would ever define it to mean anything else, but that seems like the right thing to do. #10503 |
Is this issue completely fixed? |
I believe there are still some issues to deal with. I don't want to close the issue until I've got my buildbot running. |
Status on my upcoming buildbot host after today's changes: == Tests result: FAILURE == 375 tests OK. 11 tests failed: 32 tests skipped: Most of those are dying due to pty use (openpty, etc) which is not properly memory sanitizer traced. test_posix appears to have something after that, I'll decide how to tell my buildbot not to run those tests so we can have a green buildbot memory sanitizing everything else. |
Can this be closed now? |
Nope, work remains to be done. I've got an msan buildbot system waiting but haven't had time to follow up on figuring out what remains in a while. (getting a functioning memory sanitizer build is... finnicky to say the least) |
What's the status in 2023? Maybe it's time to close the issue. If needed, new a issue can be created. |
i mean while I think it'd be useful, i'm not working on it. |
Sadly, last time I tried MSAN, I got issues with stat() and OpenSSL:
|
Sometimes tried last March: #91043 (comment) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: