@samitouri / QOSamiQemu / commits / f6ff5ec21e

tcg: Silence ubsan error on tcg_splitwx_diff causing overflow

UBSAN complains: runtime error: addition of unsigned offset to 0x7bc06e1f5000 overflowed to 0x7bc02e1f5000 Change tcg_splitwx_diff to ptrdiff_t and silence the error. Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260605132539.2775364-1-farosas@suse.de>

Fabiano Rosas committed Jun 5, 2026 at 10:25 UTC f6ff5ec21e16aeb1d283e13d0fdc13fcfb712af4
2 files changed +2 -2
include/tcg/tcg.h
+1 -1
@@ -447,7 +447,7 @@ static inline bool temp_readonly(TCGTemp *ts)
447
448 extern __thread TCGContext *tcg_ctx;
449 extern const void *tcg_code_gen_epilogue;
450 -extern uintptr_t tcg_splitwx_diff;
450 +extern ptrdiff_t tcg_splitwx_diff;
451 extern TCGv_env tcg_env;
452
453 bool in_code_gen_buffer(const void *p);
tcg/tcg.c
+1 -1
@@ -244,7 +244,7 @@ unsigned int tcg_cur_ctxs;
244 unsigned int tcg_max_ctxs;
245 TCGv_env tcg_env;
246 const void *tcg_code_gen_epilogue;
247 -uintptr_t tcg_splitwx_diff;
247 +ptrdiff_t tcg_splitwx_diff;
248
249 #ifndef CONFIG_TCG_INTERPRETER
250 tcg_prologue_fn *tcg_qemu_tb_exec;