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
bpo-34602: Quadruple stack size on macOS when compiling with UBSAN #27309
Conversation
Ideally we could only quadruple the stack size if |
Closed by mistake. I intend to add the quadrupling to pydebug builds only. |
It works now only when With:
Without:
Also, as @ammaraskar pointed out, this should be in sync with THREAD_STACK_SIZE so now it is. |
I rebased on current To demonstrate why this is necessary: Without this patch the test suite fails miserably with UBSAN
There's plenty of clear stack issues like: (click to expand) Fatal Python error: AbortedCurrent thread 0x000000010db75dc0 (most recent call first): File "/Volumes/RAMDisk/cpy2/Lib/test/libregrtest/setup.py", line 82 in _test_audit_hook File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ File "/Volumes/RAMDisk/cpy2/Lib/xml/etree/ElementTree.py", line 178 in __repr__ ... With the patch tests almost pass
The threading failure is another thing we'll have to get to work for UBSAN on macOS but it's unrelated to this bug. |
When you're done making the requested changes, leave the comment: |
I have made the requested changes; please review again. Using >>> import sysconfig
>>> sysconfig.get_config_var('LINKFORSHARED')
'-Wl,-stack_size,4000000 -framework CoreFoundation'
>>> sysconfig.get_config_var('THREAD_STACK_SIZE')
'0x4000000' No >>> import sysconfig
>>> sysconfig.get_config_var('LINKFORSHARED')
'-Wl,-stack_size,1000000 -framework CoreFoundation'
>>> sysconfig.get_config_var('THREAD_STACK_SIZE')
'0x1000000' |
Thanks for making the requested changes! @ronaldoussoren: please review the changes made to this pull request. |
Merging this since I have some UBSAN-related work for next week. |
Thanks @ambv for the PR |
Sorry, @ambv, I could not cleanly backport this to |
I'll deal with the conflict today. |
The conflict is because the 3.10 branch used autoconf 2.71 for its configure file whereas main (like the other branches) uses 2.69. |
…BSAN (pythonGH-27309) (cherry picked from commit be9de87) Co-authored-by: Łukasz Langa <[email protected]>
GH-28280 is a backport of this pull request to the 3.10 branch. |
…BSAN (GH-27309) (GH-28280) (cherry picked from commit be9de87) Co-authored-by: Łukasz Langa <[email protected]>
When running
./configure
with--with-undefined-behavior-sanitizer
, the currently used stack size on macOS is insufficient to pass the test suite.https://bugs.python.org/issue34602