Uh oh!
There was an error while loading. Please reload this page.
bpo-34602: Quadruple stack size on macOS when compiling with UBSAN - #27309
Conversation
ambv
commented
Jul 23, 2021
Ideally we could only quadruple the stack size if |
ammaraskar
left a comment
There was a problem hiding this comment.
Ideally we could only quadruple the stack size if
--with-undefined-behavior-sanitizeris used but I'm not sure how to do that.
I think you should just be able to do a conditional where LINKFORSHARED is set with
if test "$with_undefined_behavior_sanitizer" != "no"; then
Uh oh!
There was an error while loading. Please reload this page.
ambv
commented
Aug 10, 2021
Closed by mistake. I intend to add the quadrupling to pydebug builds only. |
ambv
commented
Aug 27, 2021
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. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
9f21de0 to
5d734c3Compareambv
commented
Aug 27, 2021
I rebased on current To demonstrate why this is necessary: Without this patch the test suite fails miserably with UBSANThere'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 passThe threading failure is another thing we'll have to get to work for UBSAN on macOS but it's unrelated to this bug. |
ronaldoussoren
left a comment
There was a problem hiding this comment.
The patch looks good in general, as mentioned below I'd use AC_DEFINE_UNQUOTED(THREAD_STACK_SIZE, ...) even if non using sanitisers and remove setting THREAD_STACK_SIZE for macOS from thread_pthread.h.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Aug 28, 2021
When you're done making the requested changes, leave the comment: |
ambv
commented
Aug 28, 2021
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' |
bedevere-bot
commented
Aug 28, 2021
Thanks for making the requested changes! @ronaldoussoren: please review the changes made to this pull request. |
ambv
commented
Sep 3, 2021
Merging this since I have some UBSAN-related work for next week. |
miss-islington
commented
Sep 3, 2021
Thanks @ambv for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
miss-islington
commented
Sep 3, 2021
Sorry, @ambv, I could not cleanly backport this to |
ambv
commented
Sep 3, 2021
I'll deal with the conflict today. |
ambv
commented
Sep 3, 2021
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 <lukasz@langa.pl>
bedevere-bot
commented
Sep 10, 2021
GH-28280 is a backport of this pull request to the 3.10 branch. |
When running
./configurewith--with-undefined-behavior-sanitizer, the currently used stack size on macOS is insufficient to pass the test suite.https://bugs.python.org/issue34602