mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-30924 Server crashes in MYSQL_LOG::is_open upon ALTER vs FUNCTION
ASAN showed use-after-free in binlog_online_alter_end_trans, during running through thd->online_alter_cache_list. In online_alter_binlog_get_cache_data, new_cache_data was allocated on thd->mem_root, in case of autocommit=1, but this mem_root could be freed in sp_head::execute, upon using stored functions. It appears that thd->transaction->mem_root exists even in single-stmt transaction mode (i.e autocommit=1), so it can be used in all cases. This mem_root will remain valid till the end of transaction, including commit phase.
This commit is contained in:
committed by
Sergei Golubchik
parent
6b35d6a909
commit
3ad0e7edd1
@ -1190,5 +1190,27 @@ set debug_sync= 'now signal goon';
|
||||
connection default;
|
||||
drop table t;
|
||||
#
|
||||
# MDEV-30924 Server crashes in MYSQL_LOG::is_open upon ALTER vs FUNCTION
|
||||
#
|
||||
create table t (a int);
|
||||
insert into t values (1),(2);
|
||||
create function f () returns int
|
||||
begin
|
||||
update t set a = 10;
|
||||
return 0;
|
||||
end $
|
||||
set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goon';
|
||||
alter table t force, algorithm=copy;
|
||||
connection con1;
|
||||
set debug_sync= 'now wait_for downgraded';
|
||||
select f();
|
||||
f()
|
||||
0
|
||||
set debug_sync= 'now signal goon';
|
||||
connection default;
|
||||
drop table t;
|
||||
drop function f;
|
||||
disconnect con1;
|
||||
#
|
||||
# End of 11.2 tests
|
||||
#
|
||||
|
Reference in New Issue
Block a user