tcg: Silence ubsan error on tcg_splitwx_diff causing overflow
PATCH v2 1/1 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 <[email protected]>
--- include/tcg/tcg.h | 2 +- tcg/tcg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/tcg/tcg.h +1 -1
@@ -447,7 +447,7 @@ static inline bool temp_readonly(TCGTemp *ts)extern __threadTCGContext *tcg_ctx;extern const void *tcg_code_gen_epilogue; -extern uintptr_t tcg_splitwx_diff; +extern ptrdiff_t tcg_splitwx_diff;extern TCGv_env tcg_env;bool in_code_gen_buffer (const void *p);
tcg/tcg.c +1 -1
@@ -244,7 +244,7 @@ unsigned int tcg_cur_ctxs;unsigned int tcg_max_ctxs;TCGv_env tcg_env;const void *tcg_code_gen_epilogue; -uintptr_t tcg_splitwx_diff; +ptrdiff_t tcg_splitwx_diff;#ifndef CONFIG_TCG_INTERPRETER tcg_prologue_fn *tcg_qemu_tb_exec;
Signature · 1 line
2.53.0
Quoted 11 lines · Fabiano Rosas
UBSAN complains:
runtime error: addition of unsigned offset to0x7bc06e1f5000overflowed to0x7bc02e1f5000Change
tcg_splitwx_difftoptrdiff_tand silence the error.Signed-off-by Fabiano Rosas <[email protected]>--- include/tcg/tcg.h | 2 +- tcg/tcg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by Richard Henderson <[email protected]>
r~
Quoted 27 lines
include/tcg/tcg.h +1
-1@@ -447,7 +447,7 @@ static inline bool temp_readonly(TCGTemp *ts)extern __threadTCGContext *tcg_ctx;extern const void *tcg_code_gen_epilogue; -extern uintptr_t tcg_splitwx_diff; +extern ptrdiff_t tcg_splitwx_diff;extern TCGv_env tcg_env;bool in_code_gen_buffer (const void *p);tcg/tcg.c +1
-1@@ -244,7 +244,7 @@ unsigned int tcg_cur_ctxs;unsigned int tcg_max_ctxs;TCGv_env tcg_env;const void *tcg_code_gen_epilogue; -uintptr_t tcg_splitwx_diff; +ptrdiff_t tcg_splitwx_diff;#ifndef CONFIG_TCG_INTERPRETER tcg_prologue_fn *tcg_qemu_tb_exec;
Quoted 11 lines · Fabiano Rosas
UBSAN complains:
runtime error: addition of unsigned offset to0x7bc06e1f5000overflowed to0x7bc02e1f5000Change
tcg_splitwx_difftoptrdiff_tand silence the error.Signed-off-by Fabiano Rosas <[email protected]>--- include/tcg/tcg.h | 2 +- tcg/tcg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by Philippe Mathieu-Daudé <[email protected]>