On 10/28/26 07:02, Stian Halseth wrote:
When the code buffer is full in a serial context, tb_gen_code() flushes it and retries in place. cpu_exec_loop() then chains its last_tb, now freed, into the new TB. When that TB is invalidated, tb_jmp_unlink() follows the stale entry and qemu crashes inside its SIGSEGV handler.Always queue the flush and leave through cpu_loop_exit(), as before commit ebf7a5d294a3. This also brings back the cleanup in cpu_loop_exit() and cpu_exec_longjmp_cleanup() that the retry skipped. Since commit 25e5c6a320db ("accel/tcg: Allow cross-page goto_tb chaining in user-only builds"), user-only builds hit this easily, e.g. qemu-sparc64 -tb-size 1 on a program writing next to its PLT. Cc:[email protected] Fixes: ebf7a5d294a3 ("accel/tcg: Improve buffer overflow in tb_gen_code") Suggested-by: Alex Bennée<[email protected]> Signed-off-by: Stian Halseth<[email protected]> --- v3: - Drop the in-place retry instead of clearing last_tb after it (Alex, Richard) - Matt's Reviewed-by dropped, since the code changed v2:https://lore.kernel.org/qemu-devel/[email protected]/ v1:https://lore.kernel.org/qemu-devel/[email protected]/ accel/tcg/translate-all.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
Reviewed-by: Richard Henderson <[email protected]> Queued to tcg-next. r~
