Fixed that one can compile MariaDB with ASAN with -Wframe-larger-than=16384

Added PRAGMA_DISABLE_CHECK_STACK_FRAME around some functions
This commit is contained in:
Monty 2025-05-28 15:53:58 +03:00
commit f65dda628d
13 changed files with 77 additions and 2 deletions

View file

@ -55,6 +55,7 @@
#endif #endif
#include <signal.h> #include <signal.h>
#include <my_stacktrace.h> #include <my_stacktrace.h>
#include <my_attribute.h>
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE #include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
@ -78,7 +79,7 @@ static my_bool non_blocking_api_enabled= 0;
#define MAX_DELIMITER_LENGTH 16 #define MAX_DELIMITER_LENGTH 16
#define DEFAULT_MAX_CONN 64 #define DEFAULT_MAX_CONN 64
#define DIE_BUFF_SIZE 15*1024 #define DIE_BUFF_SIZE 64*1024
#define RESULT_STRING_INIT_MEM 2048 #define RESULT_STRING_INIT_MEM 2048
#define RESULT_STRING_INCREMENT_MEM 2048 #define RESULT_STRING_INCREMENT_MEM 2048
@ -1619,6 +1620,8 @@ static void make_error_message(char *buf, size_t len, const char *fmt, va_list a
s+= my_snprintf(s, end -s, "\n"); s+= my_snprintf(s, end -s, "\n");
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static void die(const char *fmt, ...) static void die(const char *fmt, ...)
{ {
char buff[DIE_BUFF_SIZE]; char buff[DIE_BUFF_SIZE];
@ -1630,6 +1633,8 @@ static void die(const char *fmt, ...)
really_die(buff); really_die(buff);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static void really_die(const char *msg) static void really_die(const char *msg)
{ {
static int dying= 0; static int dying= 0;
@ -1658,6 +1663,8 @@ static void really_die(const char *msg)
cleanup_and_exit(1, 1); cleanup_and_exit(1, 1);
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
void report_or_die(const char *fmt, ...) void report_or_die(const char *fmt, ...)
{ {
va_list args; va_list args;
@ -1712,6 +1719,7 @@ void abort_not_supported_test(const char *fmt, ...)
cleanup_and_exit(62, 0); cleanup_and_exit(62, 0);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
void abort_not_in_this_version() void abort_not_in_this_version()
{ {

View file

@ -3903,6 +3903,8 @@ static int flush_cached_blocks(SIMPLE_KEY_CACHE_CB *keycache,
1 error 1 error
*/ */
PRAGMA_DISABLE_CHECK_STACK_FRAME
static int flush_key_blocks_int(SIMPLE_KEY_CACHE_CB *keycache, static int flush_key_blocks_int(SIMPLE_KEY_CACHE_CB *keycache,
File file, enum flush_type type) File file, enum flush_type type)
{ {
@ -4335,6 +4337,7 @@ err:
DBUG_RETURN(last_errno != 0); DBUG_RETURN(last_errno != 0);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/* /*
Flush all blocks for a file from key buffers of a simple key cache Flush all blocks for a file from key buffers of a simple key cache

View file

@ -10414,6 +10414,8 @@ static uint64 get_start_alter_id(THD *thd)
based on information about the table changes from fill_alter_inplace_info(). based on information about the table changes from fill_alter_inplace_info().
*/ */
PRAGMA_DISABLE_CHECK_STACK_FRAME
bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
const LEX_CSTRING *new_name, const LEX_CSTRING *new_name,
Table_specification_st *create_info, Table_specification_st *create_info,
@ -12028,6 +12030,7 @@ err_with_mdl:
goto err_cleanup; goto err_cleanup;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** /**

View file

@ -80,6 +80,8 @@
*/ */
#define export /* not static */ #define export /* not static */
PRAGMA_DISABLE_CHECK_STACK_FRAME
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
static Sys_var_mybool Sys_pfs_enabled( static Sys_var_mybool Sys_pfs_enabled(

View file

@ -280,6 +280,8 @@ static const LEX_CSTRING isolation_level_values[] =
static TypelibBuffer<4> isolation_level_values_typelib(isolation_level_values); static TypelibBuffer<4> isolation_level_values_typelib(isolation_level_values);
PRAGMA_DISABLE_CHECK_STACK_FRAME
namespace Show { namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */ /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */

View file

@ -278,6 +278,9 @@ group_commit_lock::lock_return_code group_commit_lock::acquire(value_type num, c
return lock_return_code::EXPIRED; return lock_return_code::EXPIRED;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
group_commit_lock::value_type group_commit_lock::release(value_type num) group_commit_lock::value_type group_commit_lock::release(value_type num)
{ {
completion_callback callbacks[950]; // 1000 fails with framesize 16384 completion_callback callbacks[950]; // 1000 fails with framesize 16384
@ -395,6 +398,8 @@ group_commit_lock::value_type group_commit_lock::release(value_type num)
return ret; return ret;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
#ifndef DBUG_OFF #ifndef DBUG_OFF
bool group_commit_lock::is_owner() bool group_commit_lock::is_owner()
{ {

View file

@ -2000,6 +2000,8 @@ func_exit:
return(ret); return(ret);
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
/** Check the consistency of an index page. /** Check the consistency of an index page.
@param[in] page index page @param[in] page index page
@param[in] index B-tree or R-tree index @param[in] index B-tree or R-tree index
@ -2436,6 +2438,8 @@ next_free:
return(ret); return(ret);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/***************************************************************//** /***************************************************************//**
Looks in the page record list for a record with the given heap number. Looks in the page record list for a record with the given heap number.
@return record, NULL if not found */ @return record, NULL if not found */

View file

@ -4617,6 +4617,8 @@ dberr_t innodb_insert_hidden_fts_col(dict_table_t* table,
"END;\n", trx); "END;\n", trx);
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
/*****************************************************************//** /*****************************************************************//**
Imports a tablespace. The space id in the .ibd file must match the space id Imports a tablespace. The space id in the .ibd file must match the space id
of the table in the data dictionary. of the table in the data dictionary.
@ -4985,3 +4987,5 @@ import_error:
return row_import_cleanup(prebuilt, err, table); return row_import_cleanup(prebuilt, err, table);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME

View file

@ -859,6 +859,8 @@ unused_undo:
return DB_SUCCESS; return DB_SUCCESS;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
/** Open the configured number of dedicated undo tablespaces. /** Open the configured number of dedicated undo tablespaces.
@param[in] create_new_undo whether the undo tablespaces has to be created @param[in] create_new_undo whether the undo tablespaces has to be created
@param[in,out] mtr mini-transaction @param[in,out] mtr mini-transaction
@ -920,6 +922,9 @@ dberr_t srv_undo_tablespaces_init(bool create_new_undo, mtr_t *mtr)
return err; return err;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** Create the temporary file tablespace. /** Create the temporary file tablespace.
@param[in] create_new_db whether we are creating a new database @param[in] create_new_db whether we are creating a new database
@return DB_SUCCESS or error code. */ @return DB_SUCCESS or error code. */
@ -1158,6 +1163,8 @@ inline lsn_t log_t::init_lsn() noexcept
return lsn; return lsn;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
/** Start InnoDB. /** Start InnoDB.
@param[in] create_new_db whether to create a new database @param[in] create_new_db whether to create a new database
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
@ -1923,6 +1930,8 @@ skip_monitors:
return(DB_SUCCESS); return(DB_SUCCESS);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** /**
Shutdown purge to make sure that there is no possibility that we call any Shutdown purge to make sure that there is no possibility that we call any
plugin code (e.g., audit) inside virtual column computation. plugin code (e.g., audit) inside virtual column computation.

View file

@ -3601,6 +3601,8 @@ static my_bool translog_is_LSN_chunk(uchar type)
@retval 1 Error @retval 1 Error
*/ */
PRAGMA_DISABLE_CHECK_STACK_FRAME
my_bool translog_init_with_table(const char *directory, my_bool translog_init_with_table(const char *directory,
uint32 log_file_max_size, uint32 log_file_max_size,
uint32 server_version, uint32 server_version,
@ -4234,6 +4236,7 @@ err:
DBUG_RETURN(1); DBUG_RETURN(1);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/* /*
@brief Free transaction log file buffer. @brief Free transaction log file buffer.

View file

@ -8600,7 +8600,6 @@ grn_obj_set_info_source_invalid_lexicon_error(grn_ctx *ctx,
source_name_size, source_name); source_name_size, source_name);
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
inline static grn_rc inline static grn_rc
grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value) grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value)
@ -8704,6 +8703,8 @@ exit:
return ctx->rc; return ctx->rc;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
inline static void inline static void
grn_obj_set_info_source_log(grn_ctx *ctx, grn_obj *obj, grn_obj *value) grn_obj_set_info_source_log(grn_ctx *ctx, grn_obj *obj, grn_obj *value)
{ {

View file

@ -31,6 +31,7 @@
#include "grn_token_cursor.h" #include "grn_token_cursor.h"
#include "grn_mrb.h" #include "grn_mrb.h"
#include "mrb/mrb_expr.h" #include "mrb/mrb_expr.h"
#include "my_attribute.h"
#ifdef GRN_WITH_ONIGMO #ifdef GRN_WITH_ONIGMO
# define GRN_SUPPORT_REGEXP # define GRN_SUPPORT_REGEXP
@ -6701,6 +6702,8 @@ grn_table_select_index_range(grn_ctx *ctx, grn_obj *table, grn_obj *index,
} }
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static inline grn_bool static inline grn_bool
grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si, grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si,
grn_obj *res, grn_id *min_id) grn_obj *res, grn_id *min_id)
@ -6818,6 +6821,8 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si,
return processed; return processed;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
grn_obj * grn_obj *
grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
grn_obj *res, grn_operator op) grn_obj *res, grn_operator op)

View file

@ -20,6 +20,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <my_attribute.h>
#ifdef WIN32 #ifdef WIN32
# include <io.h> # include <io.h>
@ -3338,6 +3339,8 @@ fake_map(grn_ctx *ctx, grn_io *io, grn_io_win *iw, void *addr, uint32_t seg, uin
iw->addr = addr; iw->addr = addr;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static grn_rc static grn_rc
buffer_flush(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h) buffer_flush(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
{ {
@ -3470,6 +3473,8 @@ buffer_flush(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
return ctx->rc; return ctx->rc;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
void void
grn_ii_buffer_check(grn_ctx *ctx, grn_ii *ii, uint32_t seg) grn_ii_buffer_check(grn_ctx *ctx, grn_ii *ii, uint32_t seg)
{ {
@ -3736,6 +3741,8 @@ array_update(grn_ctx *ctx, grn_ii *ii, uint32_t dls, buffer *db)
} }
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static grn_rc static grn_rc
buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h) buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
{ {
@ -3981,6 +3988,8 @@ buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
return ctx->rc; return ctx->rc;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
#define SCALE_FACTOR 2048 #define SCALE_FACTOR 2048
#define MAX_NTERMS 8192 #define MAX_NTERMS 8192
#define SPLIT_COND(ii, buffer)\ #define SPLIT_COND(ii, buffer)\
@ -4525,6 +4534,8 @@ PRAGMA_DISABLE_CHECK_STACK_FRAME
#define BIT11_01(x) ((x >> 1) & 0x7ff) #define BIT11_01(x) ((x >> 1) & 0x7ff)
#define BIT31_12(x) (x >> 12) #define BIT31_12(x) (x >> 12)
PRAGMA_DISABLE_CHECK_STACK_FRAME
grn_rc grn_rc
grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_hash *h) grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_hash *h)
{ {
@ -4912,6 +4923,8 @@ exit :
return ctx->rc; return ctx->rc;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
#define CHUNK_USED 1 #define CHUNK_USED 1
#define BUFFER_USED 2 #define BUFFER_USED 2
#define SOLE_DOC_USED 4 #define SOLE_DOC_USED 4
@ -6309,6 +6322,8 @@ grn_uvector2updspecs(grn_ctx *ctx, grn_ii *ii, grn_id rid,
} }
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
grn_rc grn_rc
grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section, grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section,
grn_obj *oldvalue, grn_obj *newvalue, grn_obj *posting) grn_obj *oldvalue, grn_obj *newvalue, grn_obj *posting)
@ -6628,6 +6643,8 @@ exit :
return ctx->rc; return ctx->rc;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
/* token_info */ /* token_info */
typedef struct { typedef struct {
@ -7931,6 +7948,8 @@ grn_ii_select_cursor_open(grn_ctx *ctx,
return cursor; return cursor;
} }
PRAGMA_DISABLE_CHECK_STACK_FRAME
static grn_ii_select_cursor_posting * static grn_ii_select_cursor_posting *
grn_ii_select_cursor_next(grn_ctx *ctx, grn_ii_select_cursor_next(grn_ctx *ctx,
grn_ii_select_cursor *cursor) grn_ii_select_cursor *cursor)
@ -8098,6 +8117,9 @@ grn_ii_select_cursor_next(grn_ctx *ctx,
} }
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static void static void
grn_ii_select_cursor_unshift(grn_ctx *ctx, grn_ii_select_cursor_unshift(grn_ctx *ctx,
grn_ii_select_cursor *cursor, grn_ii_select_cursor *cursor,
@ -8541,6 +8563,8 @@ grn_ii_select_sequential_search(grn_ctx *ctx,
} }
#endif #endif
PRAGMA_DISABLE_CHECK_STACK_FRAME
grn_rc grn_rc
grn_ii_select(grn_ctx *ctx, grn_ii *ii, grn_ii_select(grn_ctx *ctx, grn_ii *ii,
const char *string, unsigned int string_len, const char *string, unsigned int string_len,
@ -8847,6 +8871,8 @@ exit :
return rc; return rc;
} }
PRAGMA_REENABLE_CHECK_STACK_FRAME
static uint32_t static uint32_t
grn_ii_estimate_size_for_query_regexp(grn_ctx *ctx, grn_ii *ii, grn_ii_estimate_size_for_query_regexp(grn_ctx *ctx, grn_ii *ii,
const char *query, unsigned int query_len, const char *query, unsigned int query_len,