-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
enable usage of AddressSanitizer in CPython [PATCH] #62796
Comments
Hi, When trying to build CPython "tip" with AddressSanitizer enabled, I get the following crash, make Parser/pgen ... AddressSanitizer is a fast memory error detector. See http://clang.llvm.org/docs/AddressSanitizer.html for details. Build options used export CFLAGS="-fsanitize=address -g" export LDFLAGS="-fsanitize=address" ./configure --prefix=/opt/python --with-valgrind Software Versions $ hg log changeset: 84902:6e1dd1ce95b8 $ gcc --version
gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)
$ cat /etc/redhat-release
Fedora release 19 (Schrödinger’s Cat) Fix / Work-around See http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer#Turning_off_instrumentation Turning off the instrumentation for _PyObject_Free and _PyObject_Realloc is required. Advantages AddressSanitizer can *now* be used to test and debug CPython. AddressSanitizer has helped me find a large number of bugs in other softwares. |
This patch should only be applied if we are sure that the allocator is fine and doing such things by design. |
The warning is due to the Py_ADDRESS_IN_RANGE() macro: it's a know limitation, we have the same problem with valgrind. This would be a nice neature. It would IMO be even nicer to have an ASAN-enabled buildbot. |
Using, # define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS __attribute__((no_address_safety_analysis)) __attribute__ ((noinline)) instead of, # define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS __attribute__((no_address_safety_analysis)) seems to be a more future-proof (against inlining) solution. |
I am attaching the latest tested patch against tip. |
New changeset f6792f734fcc by Nick Coghlan in branch 'default': |
Incorporated, but as Charles-François noted, a buildbot running with it enabled would be nice. |
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: