Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4162bc1

Browse filesBrowse files
authored
gh-130396: Fix thread sanitizer crashes on stack overflow tests (gh-130966)
Thread sanitizer will often crash if a test uses more than half the stack.
1 parent 1908115 commit 4162bc1
Copy full SHA for 4162bc1

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed

‎Python/ceval.c

Copy file name to clipboardExpand all lines: Python/ceval.c
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,12 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
392392
if (err == 0) {
393393
uintptr_t base = ((uintptr_t)stack_addr) + guard_size;
394394
_tstate->c_stack_top = base + stack_size;
395+
#ifdef _Py_THREAD_SANITIZER
396+
// Thread sanitizer crashes if we use a bit more than half the stack.
397+
_tstate->c_stack_soft_limit = base + (stack_size / 2);
398+
#else
395399
_tstate->c_stack_soft_limit = base + PYOS_STACK_MARGIN_BYTES * 2;
400+
#endif
396401
_tstate->c_stack_hard_limit = base + PYOS_STACK_MARGIN_BYTES;
397402
assert(_tstate->c_stack_soft_limit < here_addr);
398403
assert(here_addr < _tstate->c_stack_top);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.