qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] translate-all: fix uninitialized tb->orig_tb
@ 2019-10-22 14:00 Clement Deschamps
  2019-10-23 14:50 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Clement Deschamps @ 2019-10-22 14:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Clement Deschamps, Richard Henderson

This fixes a segmentation fault in icount mode when executing from an IO region.

TB is marked as CF_NOCACHE but tb->orig_tb is not initialized (equals
previous value in code_gen_buffer).

The issue happens in cpu_io_recompile() when it tries to invalidate orig_tb.

Signed-off-by: Clement Deschamps <clement.deschamps@greensocs.com>
---
 accel/tcg/translate-all.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 66d4bc4341..f9b7ba159d 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1722,6 +1722,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
     tb->cs_base = cs_base;
     tb->flags = flags;
     tb->cflags = cflags;
+    tb->orig_tb = NULL;
     tb->trace_vcpu_dstate = *cpu->trace_dstate;
     tcg_ctx->tb_cflags = cflags;
  tb_overflow:
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] translate-all: fix uninitialized tb->orig_tb
  2019-10-22 14:00 [PATCH] translate-all: fix uninitialized tb->orig_tb Clement Deschamps
@ 2019-10-23 14:50 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2019-10-23 14:50 UTC (permalink / raw)
  To: Clement Deschamps, qemu-devel; +Cc: Paolo Bonzini, Richard Henderson

On 10/22/19 10:00 AM, Clement Deschamps wrote:
> This fixes a segmentation fault in icount mode when executing from an IO region.
> 
> TB is marked as CF_NOCACHE but tb->orig_tb is not initialized (equals
> previous value in code_gen_buffer).
> 
> The issue happens in cpu_io_recompile() when it tries to invalidate orig_tb.
> 
> Signed-off-by: Clement Deschamps <clement.deschamps@greensocs.com>
> ---
>  accel/tcg/translate-all.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 66d4bc4341..f9b7ba159d 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -1722,6 +1722,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
>      tb->cs_base = cs_base;
>      tb->flags = flags;
>      tb->cflags = cflags;
> +    tb->orig_tb = NULL;

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Yep, the key is the the I/O region, when phys_pc == -1; previously the only
place that set CF_NOCACHE was cpu_exec_nocache, which is where orig_tb is
normally set.

Queued.


r~


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-23 14:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 14:00 [PATCH] translate-all: fix uninitialized tb->orig_tb Clement Deschamps
2019-10-23 14:50 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).