Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
-
None
Description
create or replace table t1 (i int); |
create or replace table t2 like t1; |
|
--delimiter $
|
create or replace procedure p(n int) |
begin |
insert into t1 values (n); |
replace into t2 select * from t1; |
end $ |
--delimiter ;
|
|
call p(1);
|
|
alter table t1 add system versioning; |
alter table t2 add system versioning; |
|
call p(3);
|
call p(4);
|
|
# Cleanup
|
drop procedure p; |
drop table t1, t2; |
10.3 debug 9f84451d87ba1 |
#3 <signal handler called>
|
#4 0x00005644a33c1959 in setup_on_expr (thd=0x7fbaa8000b00, table=0x7fbaa8126838, is_update=true) at /data/src/10.3/sql/sql_base.cc:7949
|
#5 0x00005644a33c1f12 in setup_conds (thd=0x7fbaa8000b00, tables=0x7fbaa8126838, leaves=..., conds=0x7fbaa8075140) at /data/src/10.3/sql/sql_base.cc:8069
|
#6 0x00005644a347fd9b in setup_without_group (thd=0x7fbaa8000b00, ref_pointer_array=..., tables=0x7fbaa8126838, leaves=..., fields=..., all_fields=..., conds=0x7fbaa8075140, order=0x0, group=0x0, win_specs=..., win_funcs=..., hidden_group_fields=0x7fbaa807501f, reserved=0x7fbaa812cc04) at /data/src/10.3/sql/sql_select.cc:646
|
#7 0x00005644a348209e in JOIN::prepare (this=0x7fbaa8074d38, tables_init=0x7fbaa8126838, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fbaa812c928, unit_arg=0x7fbaa812c1b0) at /data/src/10.3/sql/sql_select.cc:1103
|
#8 0x00005644a348cd8f in mysql_select (thd=0x7fbaa8000b00, tables=0x7fbaa8126838, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489926912, result=0x7fbaa8074c90, unit=0x7fbaa812c1b0, select_lex=0x7fbaa812c928) at /data/src/10.3/sql/sql_select.cc:4130
|
#9 0x00005644a347f39f in handle_select (thd=0x7fbaa8000b00, lex=0x7fbaa812c0e8, result=0x7fbaa8074c90, setup_tables_done_option=1073741824) at /data/src/10.3/sql/sql_select.cc:382
|
#10 0x00005644a3444321 in mysql_execute_command (thd=0x7fbaa8000b00) at /data/src/10.3/sql/sql_parse.cc:4831
|
#11 0x00005644a3370fc8 in sp_instr_stmt::exec_core (this=0x7fbaa8126e88, thd=0x7fbaa8000b00, nextp=0x7fbaba49c6fc) at /data/src/10.3/sql/sp_head.cc:3595
|
#12 0x00005644a33703d8 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7fbaa8126ed8, thd=0x7fbaa8000b00, nextp=0x7fbaba49c6fc, open_tables=false, instr=0x7fbaa8126e88) at /data/src/10.3/sql/sp_head.cc:3311
|
#13 0x00005644a3370b81 in sp_instr_stmt::execute (this=0x7fbaa8126e88, thd=0x7fbaa8000b00, nextp=0x7fbaba49c6fc) at /data/src/10.3/sql/sp_head.cc:3498
|
#14 0x00005644a336a945 in sp_head::execute (this=0x7fbaa8077518, thd=0x7fbaa8000b00, merge_da_on_success=true) at /data/src/10.3/sql/sp_head.cc:1349
|
#15 0x00005644a336d2ea in sp_head::execute_procedure (this=0x7fbaa8077518, thd=0x7fbaa8000b00, args=0x7fbaa80056e0) at /data/src/10.3/sql/sp_head.cc:2287
|
#16 0x00005644a343e9bf in do_execute_sp (thd=0x7fbaa8000b00, sp=0x7fbaa8077518) at /data/src/10.3/sql/sql_parse.cc:2944
|
#17 0x00005644a343f53c in Sql_cmd_call::execute (this=0x7fbaa8014e18, thd=0x7fbaa8000b00) at /data/src/10.3/sql/sql_parse.cc:3186
|
#18 0x00005644a34497db in mysql_execute_command (thd=0x7fbaa8000b00) at /data/src/10.3/sql/sql_parse.cc:6282
|
#19 0x00005644a344e2a8 in mysql_parse (thd=0x7fbaa8000b00, rawbuf=0x7fbaa8014d58 "call p(4)", length=9, parser_state=0x7fbaba49e5d0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8001
|
#20 0x00005644a343ba8b in dispatch_command (command=COM_QUERY, thd=0x7fbaa8000b00, packet=0x7fbaa808ff81 "call p(4)", packet_length=9, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1846
|
#21 0x00005644a343a4ca in do_command (thd=0x7fbaa8000b00) at /data/src/10.3/sql/sql_parse.cc:1391
|
#22 0x00005644a359cfbd in do_handle_one_connection (connect=0x5644a5be1e30) at /data/src/10.3/sql/sql_connect.cc:1402
|
#23 0x00005644a359cd4a in handle_one_connection (arg=0x5644a5be1e30) at /data/src/10.3/sql/sql_connect.cc:1308
|
#24 0x00005644a3a209bb in pfs_spawn_thread (arg=0x5644a5bf56d0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
|
#25 0x00007fbac1fce494 in start_thread (arg=0x7fbaba49f700) at pthread_create.c:333
|
#26 0x00007fbac03b493f in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
10.3 ASAN c39f8a80c9fe7f |
==26264==ERROR: AddressSanitizer: heap-use-after-free on address 0x625000100f10 at pc 0x55e12fd99ed2 bp 0x7f05603f8c30 sp 0x7f05603f8c28
|
READ of size 8 at 0x625000100f10 thread T5
|
#0 0x55e12fd99ed1 in setup_on_expr(THD*, TABLE_LIST*, bool) /data/src/10.3/sql/sql_base.cc:7949
|
#1 0x55e12fd9ae5f in setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**) /data/src/10.3/sql/sql_base.cc:8069
|
#2 0x55e12ff5a74d in setup_without_group /data/src/10.3/sql/sql_select.cc:646
|
#3 0x55e12ff5f72b in JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /data/src/10.3/sql/sql_select.cc:1103
|
#4 0x55e12ff7d259 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.3/sql/sql_select.cc:4130
|
#5 0x55e12ff589dd in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.3/sql/sql_select.cc:382
|
#6 0x55e12fecf737 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4831
|
#7 0x55e12fce4ab7 in sp_instr_stmt::exec_core(THD*, unsigned int*) /data/src/10.3/sql/sp_head.cc:3595
|
#8 0x55e12fce32f7 in sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) /data/src/10.3/sql/sp_head.cc:3311
|
#9 0x55e12fce4204 in sp_instr_stmt::execute(THD*, unsigned int*) /data/src/10.3/sql/sp_head.cc:3498
|
#10 0x55e12fcd7465 in sp_head::execute(THD*, bool) /data/src/10.3/sql/sp_head.cc:1349
|
#11 0x55e12fcdc71d in sp_head::execute_procedure(THD*, List<Item>*) /data/src/10.3/sql/sp_head.cc:2287
|
#12 0x55e12fec43eb in do_execute_sp /data/src/10.3/sql/sql_parse.cc:2944
|
#13 0x55e12fec5e41 in Sql_cmd_call::execute(THD*) /data/src/10.3/sql/sql_parse.cc:3186
|
#14 0x55e12fed97f3 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:6282
|
#15 0x55e12fee3d62 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:8001
|
#16 0x55e12febe608 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1846
|
#17 0x55e12febb69f in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1391
|
#18 0x55e13022405c in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1402
|
#19 0x55e130223a71 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
|
#20 0x55e130d285b9 in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
|
#21 0x7f056c9c2493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
|
#22 0x7f056ada893e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
|
|
0x625000100f10 is located 7696 bytes inside of 8268-byte region [0x6250000ff100,0x62500010114c)
|
freed by thread T5 here:
|
#0 0x7f056cc2c527 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54527)
|
#1 0x55e1316eb065 in free_memory /data/src/10.3/mysys/safemalloc.c:279
|
#2 0x55e1316ea66b in sf_free /data/src/10.3/mysys/safemalloc.c:197
|
#3 0x55e1316b93f3 in my_free /data/src/10.3/mysys/my_malloc.c:222
|
#4 0x55e131699624 in free_root /data/src/10.3/mysys/my_alloc.c:418
|
#5 0x55e12fcd7603 in sp_head::execute(THD*, bool) /data/src/10.3/sql/sp_head.cc:1368
|
#6 0x55e12fcdc71d in sp_head::execute_procedure(THD*, List<Item>*) /data/src/10.3/sql/sp_head.cc:2287
|
#7 0x55e12fec43eb in do_execute_sp /data/src/10.3/sql/sql_parse.cc:2944
|
#8 0x55e12fec5e41 in Sql_cmd_call::execute(THD*) /data/src/10.3/sql/sql_parse.cc:3186
|
#9 0x55e12fed97f3 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:6282
|
#10 0x55e12fee3d62 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:8001
|
#11 0x55e12febe608 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1846
|
#12 0x55e12febb69f in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1391
|
#13 0x55e13022405c in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1402
|
#14 0x55e130223a71 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
|
#15 0x55e130d285b9 in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
|
#16 0x7f056c9c2493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
|
|
previously allocated by thread T5 here:
|
#1 0x55e1316e9ddb in sf_malloc /data/src/10.3/mysys/safemalloc.c:118
|
#2 0x55e1316b8ae6 in my_malloc /data/src/10.3/mysys/my_malloc.c:101
|
#3 0x55e1316984f7 in alloc_root /data/src/10.3/mysys/my_alloc.c:249
|
#4 0x55e12fef21f3 in Query_arena::memdup_w_gap(void const*, unsigned long, unsigned long) /data/src/10.3/sql/sql_class.h:1028
|
#5 0x55e12fec2c6e in alloc_query(THD*, char const*, unsigned long) /data/src/10.3/sql/sql_parse.cc:2678
|
#6 0x55e12fce40e1 in sp_instr_stmt::execute(THD*, unsigned int*) /data/src/10.3/sql/sp_head.cc:3485
|
#7 0x55e12fcd7465 in sp_head::execute(THD*, bool) /data/src/10.3/sql/sp_head.cc:1349
|
#8 0x55e12fcdc71d in sp_head::execute_procedure(THD*, List<Item>*) /data/src/10.3/sql/sp_head.cc:2287
|
#9 0x55e12fec43eb in do_execute_sp /data/src/10.3/sql/sql_parse.cc:2944
|
#10 0x55e12fec5e41 in Sql_cmd_call::execute(THD*) /data/src/10.3/sql/sql_parse.cc:3186
|
#11 0x55e12fed97f3 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:6282
|
#12 0x55e12fee3d62 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:8001
|
#13 0x55e12febe608 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1846
|
#14 0x55e12febb69f in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1391
|
#15 0x55e13022405c in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1402
|
#16 0x55e130223a71 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
|
#17 0x55e130d285b9 in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
|
#18 0x7f056c9c2493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
|
|
Thread T5 created by T0 here:
|
#0 0x7f056cbfbbba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
|
#1 0x55e130d28b81 in spawn_thread_v1 /data/src/10.3/storage/perfschema/pfs.cc:1912
|
#2 0x55e12fc306ee in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
|
#3 0x55e12fc46413 in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6554
|
#4 0x55e12fc46b18 in create_new_thread /data/src/10.3/sql/mysqld.cc:6624
|
#5 0x55e12fc47b29 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6899
|
#6 0x55e12fc458d0 in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6176
|
#7 0x55e12fc2ea8f in main /data/src/10.3/sql/main.cc:25
|
#8 0x7f056ace02b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
|
|
SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.3/sql/sql_base.cc:7949 setup_on_expr(THD*, TABLE_LIST*, bool)
|
Shadow bytes around the buggy address:
|
0x0c4a80018190: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c4a800181a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c4a800181b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c4a800181c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c4a800181d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
=>0x0c4a800181e0: fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c4a800181f0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c4a80018200: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c4a80018210: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c4a80018220: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa
|
0x0c4a80018230: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
Shadow byte legend (one shadow byte represents 8 application bytes):
|
Addressable: 00
|
Partially addressable: 01 02 03 04 05 06 07
|
Heap left redzone: fa
|
Heap right redzone: fb
|
Freed heap region: fd
|
Stack left redzone: f1
|
Stack mid redzone: f2
|
Stack right redzone: f3
|
Stack partial redzone: f4
|
Stack after return: f5
|
Stack use after scope: f8
|
Global redzone: f9
|
Global init order: f6
|
Poisoned by user: f7
|
Contiguous container OOB:fc
|
ASan internal: fe
|
==26264==ABORTING
|
10.3 non-debug c39f8a80c9fe |
#7 0x00007fc90c8140b1 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
|
#8 0x00007fc90c814b8f in __cxa_pure_virtual () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
|
#9 0x000056237619394b in substitute_for_best_equal_field (thd=0x7fc8f40009a8, context_tab=0x1, cond=0x7fc8f40ab378, cond_equal=0x0, table_join_idx=0x7fc8f40aa158) at /data/src/10.3/sql/sql_select.cc:14582
|
#10 0x00005623761ad5d6 in JOIN::optimize_stage2 (this=0x7fc8f40a9830) at /data/src/10.3/sql/sql_select.cc:2000
|
#11 0x00005623761afff1 in JOIN::optimize_inner (this=0x7fc8f40a9830) at /data/src/10.3/sql/sql_select.cc:1859
|
#12 0x00005623761b01ef in JOIN::optimize (this=this@entry=0x7fc8f40a9830) at /data/src/10.3/sql/sql_select.cc:1431
|
#13 0x00005623761b25a0 in mysql_select (thd=thd@entry=0x7fc8f40009a8, tables=0x7fc8f40750b0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489926912, result=0x7fc8f40a9788, unit=0x7fc8f4068c28, select_lex=0x7fc8f40693a0) at /data/src/10.3/sql/sql_select.cc:4138
|
#14 0x00005623761b2767 in handle_select (thd=0x7fc8f40009a8, lex=0x7fc8f4068b60, result=0x7fc8f40a9788, setup_tables_done_option=1073741824) at /data/src/10.3/sql/sql_select.cc:382
|
#15 0x0000562376161da2 in mysql_execute_command (thd=0x7fc8f40009a8) at /data/src/10.3/sql/sql_parse.cc:4831
|
#16 0x00005623760d6964 in sp_instr_stmt::exec_core (this=0x7fc8f4075700, thd=<optimized out>, nextp=0x7fc90609b474) at /data/src/10.3/sql/sp_head.cc:3595
|
#17 0x00005623760dd857 in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x7fc8f4075748, thd=thd@entry=0x7fc8f40009a8, nextp=nextp@entry=0x7fc90609b474, open_tables=open_tables@entry=false, instr=instr@entry=0x7fc8f4075700) at /data/src/10.3/sql/sp_head.cc:3311
|
#18 0x00005623760de3d4 in sp_instr_stmt::execute (this=0x7fc8f4075700, thd=0x7fc8f40009a8, nextp=0x7fc90609b474) at /data/src/10.3/sql/sp_head.cc:3498
|
#19 0x00005623760d9d9b in sp_head::execute (this=this@entry=0x7fc8f4071800, thd=thd@entry=0x7fc8f40009a8, merge_da_on_success=merge_da_on_success@entry=true) at /data/src/10.3/sql/sp_head.cc:1349
|
#20 0x00005623760db03e in sp_head::execute_procedure (this=0x7fc8f4071800, thd=0x7fc8f40009a8, args=0x7fc8f40053c0) at /data/src/10.3/sql/sp_head.cc:2287
|
#21 0x00005623761554bd in do_execute_sp (thd=0x7fc8f40009a8, sp=0x2, sp@entry=0x7fc8f40009a8) at /data/src/10.3/sql/sql_parse.cc:2944
|
#22 0x00005623761568e6 in Sql_cmd_call::execute (this=this@entry=0x7fc8f4011740, thd=thd@entry=0x7fc8f40009a8) at /data/src/10.3/sql/sql_parse.cc:3186
|
#23 0x0000562376157177 in Sql_cmd_call::execute (this=0x7fc8f4011740, thd=0x7fc8f40009a8) at /data/src/10.3/sql/sql_parse.cc:3140
|
#24 0x000056237615ca27 in mysql_execute_command (thd=0x7fc8f40009a8) at /data/src/10.3/sql/sql_parse.cc:6282
|
#25 0x000056237616326d in mysql_parse (thd=0x7fc8f40009a8, rawbuf=<optimized out>, length=9, parser_state=0x7fc90609d610, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.3/sql/sql_parse.cc:8001
|
#26 0x0000562376165b7f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fc8f40009a8, packet=packet@entry=0x7fc8f4009319 "call p(4)", packet_length=packet_length@entry=9, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:1846
|
#27 0x00005623761663f6 in do_command (thd=0x7fc8f40009a8) at /data/src/10.3/sql/sql_parse.cc:1391
|
#28 0x00005623762329e4 in do_handle_one_connection (connect=connect@entry=0x56237807f708) at /data/src/10.3/sql/sql_connect.cc:1402
|
#29 0x0000562376232b84 in handle_one_connection (arg=arg@entry=0x56237807f708) at /data/src/10.3/sql/sql_connect.cc:1308
|
#30 0x000056237650f964 in pfs_spawn_thread (arg=0x56237808b658) at /data/src/10.3/storage/perfschema/pfs.cc:1862
|
#31 0x00007fc90dbcf494 in start_thread (arg=0x7fc90609e700) at pthread_create.c:333
|
#32 0x00007fc90bfb593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
Stored functions also crash.
Attachments
Issue Links
- relates to
-
MDEV-21234 Server crashes in in setup_on_expr upon 3rd execution of SP
- Closed