Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mysql-test/main/thread_stack_overrun.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--thread-stack=256K
5 changes: 5 additions & 0 deletions mysql-test/main/thread_stack_overrun.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# MDEV-37781 ASAN build crashes with low thread stack
#
EXECUTE IMMEDIATE CONCAT('SELECT 1', REPEAT('+1', @@global.thread_stack));
ERROR HY000: Thread stack overrun: # bytes used of a # byte stack, and # bytes needed. Consider increasing the thread_stack system variable.
15 changes: 15 additions & 0 deletions mysql-test/main/thread_stack_overrun.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--echo #
--echo # MDEV-37781 ASAN build crashes with low thread stack
--echo #

--source include/not_embedded.inc

# Expression like 1+1+...+1 recurses once per term in fix_fields().
# As each recursion level consumes at least one byte of stack, we use
# @@global.thread_stack terms to have a guaranteed stack overrun
# on any platform, no matter the frame size.

--replace_regex /[0-9]+ bytes used of a [0-9]+ byte stack, and [0-9]+ bytes needed/# bytes used of a # byte stack, and # bytes needed/

--error ER_STACK_OVERRUN_NEED_MORE
EXECUTE IMMEDIATE CONCAT('SELECT 1', REPEAT('+1', @@global.thread_stack));
2 changes: 0 additions & 2 deletions sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7636,7 +7636,6 @@ __attribute__((optimize("-O0")))
#endif
check_stack_overrun(THD *thd, long margin, uchar *buf __attribute__((unused)))
{
#ifndef __SANITIZE_ADDRESS__
long stack_used;
DBUG_ASSERT(thd == current_thd);
DBUG_ASSERT(thd->thread_stack);
Expand All @@ -7661,7 +7660,6 @@ check_stack_overrun(THD *thd, long margin, uchar *buf __attribute__((unused)))
#ifndef DBUG_OFF
max_stack_used= MY_MAX(max_stack_used, stack_used);
#endif
#endif /* __SANITIZE_ADDRESS__ */
return 0;
}

Expand Down