Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
bpo-34602: Quadruple stack size on macOS when compiling with UBSAN#27309
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3 Misc/NEWS.d/next/macOS/2021-08-27-16-55-10.bpo-34602.ZjHsYJ.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| When building CPython on macOS with ``./configure | ||
| --with-undefined-behavior-sanitizer --with-pydebug``, the stack size is now | ||
| quadrupled to allow for the entire test suite to pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2595,6 +2595,47 @@ case $ac_sys_system/$ac_sys_release in | ||
| ;; | ||
| esac | ||
| AC_MSG_CHECKING(for --with-address-sanitizer) | ||
ambv marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| AC_ARG_WITH(address_sanitizer, | ||
| AS_HELP_STRING([--with-address-sanitizer], | ||
| [enable AddressSanitizer memory error detector, 'asan' (default is no)]), | ||
| [ | ||
| AC_MSG_RESULT($withval) | ||
| BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS" | ||
| LDFLAGS="-fsanitize=address $LDFLAGS" | ||
| # ASan works by controlling memory allocation, our own malloc interferes. | ||
| with_pymalloc="no" | ||
| ], | ||
| [AC_MSG_RESULT(no)]) | ||
| AC_MSG_CHECKING(for --with-memory-sanitizer) | ||
| AC_ARG_WITH(memory_sanitizer, | ||
| AS_HELP_STRING([--with-memory-sanitizer], | ||
| [enable MemorySanitizer allocation error detector, 'msan' (default is no)]), | ||
| [ | ||
| AC_MSG_RESULT($withval) | ||
| BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS" | ||
| LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS" | ||
| # MSan works by controlling memory allocation, our own malloc interferes. | ||
| with_pymalloc="no" | ||
| ], | ||
| [AC_MSG_RESULT(no)]) | ||
| AC_MSG_CHECKING(for --with-undefined-behavior-sanitizer) | ||
| AC_ARG_WITH(undefined_behavior_sanitizer, | ||
| AS_HELP_STRING([--with-undefined-behavior-sanitizer], | ||
| [enable UndefinedBehaviorSanitizer undefined behaviour detector, 'ubsan' (default is no)]), | ||
| [ | ||
| AC_MSG_RESULT($withval) | ||
| BASECFLAGS="-fsanitize=undefined $BASECFLAGS" | ||
| LDFLAGS="-fsanitize=undefined $LDFLAGS" | ||
| with_ubsan="yes" | ||
| ], | ||
| [ | ||
| AC_MSG_RESULT(no) | ||
| with_ubsan="no" | ||
| ]) | ||
| # Set info about shared libraries. | ||
| AC_SUBST(SHLIB_SUFFIX) | ||
| AC_SUBST(LDSHARED) | ||
| @@ -2798,9 +2839,18 @@ then | ||
| # Issue #18075: the default maximum stack size (8MBytes) is too | ||
| # small for the default recursion limit. Increase the stack size | ||
| # to ensure that tests don't crash | ||
| # Note: This matches the value of THREAD_STACK_SIZE in | ||
| # thread_pthread.h | ||
| LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED" | ||
| stack_size="1000000" # 16 MB | ||
| if test "$with_ubsan" == "yes" | ||
| then | ||
| # Undefined behavior sanitizer requires an even deeper stack | ||
| stack_size="4000000" # 64 MB | ||
| fi | ||
| LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED" | ||
| AC_DEFINE_UNQUOTED(THREAD_STACK_SIZE, | ||
| 0x$stack_size, | ||
| [Custom thread stack size depending on chosen sanitizer runtimes.]) | ||
| if test "$enable_framework" | ||
| then | ||
| @@ -3044,43 +3094,6 @@ esac | ||
| AC_MSG_RESULT("$TZPATH")]) | ||
| AC_SUBST(TZPATH) | ||
| AC_MSG_CHECKING(for --with-address-sanitizer) | ||
| AC_ARG_WITH(address_sanitizer, | ||
| AS_HELP_STRING([--with-address-sanitizer], | ||
| [enable AddressSanitizer memory error detector, 'asan' (default is no)]), | ||
| [ | ||
| AC_MSG_RESULT($withval) | ||
| BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS" | ||
| LDFLAGS="-fsanitize=address $LDFLAGS" | ||
| # ASan works by controlling memory allocation, our own malloc interferes. | ||
| with_pymalloc="no" | ||
| ], | ||
| [AC_MSG_RESULT(no)]) | ||
| AC_MSG_CHECKING(for --with-memory-sanitizer) | ||
| AC_ARG_WITH(memory_sanitizer, | ||
| AS_HELP_STRING([--with-memory-sanitizer], | ||
| [enable MemorySanitizer allocation error detector, 'msan' (default is no)]), | ||
| [ | ||
| AC_MSG_RESULT($withval) | ||
| BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS" | ||
| LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS" | ||
| # MSan works by controlling memory allocation, our own malloc interferes. | ||
| with_pymalloc="no" | ||
| ], | ||
| [AC_MSG_RESULT(no)]) | ||
| AC_MSG_CHECKING(for --with-undefined-behavior-sanitizer) | ||
| AC_ARG_WITH(undefined_behavior_sanitizer, | ||
| AS_HELP_STRING([--with-undefined-behavior-sanitizer], | ||
| [enable UndefinedBehaviorSanitizer undefined behaviour detector, 'ubsan' (default is no)]), | ||
| [ | ||
| AC_MSG_RESULT($withval) | ||
| BASECFLAGS="-fsanitize=undefined $BASECFLAGS" | ||
| LDFLAGS="-fsanitize=undefined $LDFLAGS" | ||
| ], | ||
| [AC_MSG_RESULT(no)]) | ||
| # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. | ||
| AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 | ||
| AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.