MDEV-34388: Stack overflow on Alpine Linux (postfix) mroonga+asan

The following mroonga functions had approaching 64k stack frames, so
exclude these:

* chunk_merge - ~60k
* buffer_merge - ~78k
* grn_ii_update_one - ~60k
This commit is contained in:
Daniel Black 2025-05-28 17:07:50 +10:00
commit 88d35c5c51

View file

@ -44,6 +44,8 @@
# include <onigmo.h>
#endif
#include "my_attribute.h"
#define MAX_PSEG 0x20000
#define MAX_PSEG_SMALL 0x00200
/* MAX_PSEG_MEDIUM has enough space for the following source:
@ -2833,6 +2835,8 @@ chunk_flush(grn_ctx *ctx, grn_ii *ii, chunk_info *cinfo, uint8_t *enc, uint32_t
return ctx->rc;
}
PRAGMA_DISABLE_CHECK_STACK_FRAME
static grn_rc
chunk_merge(grn_ctx *ctx, grn_ii *ii, buffer *sb, buffer_term *bt,
chunk_info *cinfo, grn_id rid, datavec *dv,
@ -2940,6 +2944,8 @@ chunk_merge(grn_ctx *ctx, grn_ii *ii, buffer *sb, buffer_term *bt,
return ctx->rc;
}
PRAGMA_REENABLE_CHECK_STACK_FRAME
static void
buffer_merge_dump_datavec(grn_ctx *ctx,
grn_ii *ii,
@ -2989,6 +2995,8 @@ buffer_merge_dump_datavec(grn_ctx *ctx,
GRN_OBJ_FIN(ctx, &buffer);
}
PRAGMA_DISABLE_CHECK_STACK_FRAME
/* If dc doesn't have enough space, program may be crashed.
* TODO: Support auto space extension or max size check.
*/
@ -3314,6 +3322,8 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h,
return ctx->rc;
}
PRAGMA_REENABLE_CHECK_STACK_FRAME
static void
fake_map(grn_ctx *ctx, grn_io *io, grn_io_win *iw, void *addr, uint32_t seg, uint32_t size)
{
@ -4509,6 +4519,9 @@ grn_ii_get_disk_usage(grn_ctx *ctx, grn_ii *ii)
return usage;
}
PRAGMA_DISABLE_CHECK_STACK_FRAME
#define BIT11_01(x) ((x >> 1) & 0x7ff)
#define BIT31_12(x) (x >> 12)
@ -4784,6 +4797,8 @@ exit :
return ctx->rc;
}
PRAGMA_REENABLE_CHECK_STACK_FRAME
grn_rc
grn_ii_delete_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_hash *h)
{