1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-34388: Stack overflow on Alpine Linux

page_is_corrupted(): Do not allocate the buffers from stack,
but from the heap, in xb_fil_cur_open().

row_quiesce_write_cfg(): Issue one type of message when we
fail to create the .cfg file.

update_statistics_for_table(), read_statistics_for_table(),
delete_statistics_for_table(), rename_table_in_stat_tables():
Use a common stack buffer for Index_stat, Column_stat, Table_stat.

ha_connect::FileExists(): Invoke push_warning_printf() so that
we can avoid allocating a buffer for snprintf().

translog_init_with_table(): Do not duplicate TRANSLOG_PAGE_SIZE_BUFF.

Let us also globally enable the GCC 4.4 and clang 3.0 option
-Wframe-larger-than=16384 to reduce the possibility of introducing
such stack overflow in the future.  For RocksDB and Mroonga we relax
these limits.

Reviewed by: Vladislav Lesin
This commit is contained in:
Marko Mäkelä
2025-05-20 17:27:05 +03:00
parent 2350295643
commit 82d7419e06
21 changed files with 130 additions and 119 deletions

View File

@@ -81,8 +81,7 @@ SET @saved_debug_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,ib_export_io_write_failure_1";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -91,8 +90,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_2";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -101,8 +99,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_3";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -111,8 +108,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_4";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -121,8 +117,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_5";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -131,8 +126,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_6";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -141,8 +135,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_7";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -151,8 +144,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_8";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -161,8 +153,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_9";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -171,8 +162,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_10";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -181,8 +171,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_11";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
@@ -191,8 +180,7 @@ INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_12";
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor")
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t1;