bpo-34602: Quadruple stack size on macOS when compiling with UBSAN (GH-27309)

This commit is contained in:
Łukasz Langa 2021-09-03 09:32:19 +02:00 committed by GitHub
parent b4b6342848
commit be9de8721d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 146 additions and 113 deletions

View file

@ -32,18 +32,17 @@
#define THREAD_STACK_SIZE 0 /* use default stack size */
#endif
/* The default stack size for new threads on OSX and BSD is small enough that
/* The default stack size for new threads on BSD is small enough that
* we'll get hard crashes instead of 'maximum recursion depth exceeded'
* exceptions.
*
* The default stack sizes below are the empirically determined minimal stack
* The default stack size below is the empirically determined minimal stack
* sizes where a simple recursive function doesn't cause a hard crash.
*
* For macOS the value of THREAD_STACK_SIZE is determined in configure.ac
* as it also depends on the other configure options like chosen sanitizer
* runtimes.
*/
#if defined(__APPLE__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
#undef THREAD_STACK_SIZE
/* Note: This matches the value of -Wl,-stack_size in configure.ac */
#define THREAD_STACK_SIZE 0x1000000
#endif
#if defined(__FreeBSD__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
#undef THREAD_STACK_SIZE
#define THREAD_STACK_SIZE 0x400000