From 988bf2f4581202979429cdf0c9fe1a2cafee2b5e Mon Sep 17 00:00:00 2001 From: Richard Henderson <richard.henderson@linaro.org> Date: Thu, 1 Apr 2021 16:03:57 -0400 Subject: [PATCH] target/i386: Verify memory operand for lcall and ljmp These two opcodes only allow a memory operand. Lacking the check for a register operand, we used the A0 temp without initialization, which led to a tcg abort. Backports 10b8eb94c0902b58d83df84a9eeae709a3480e82 --- qemu/target/i386/translate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qemu/target/i386/translate.c b/qemu/target/i386/translate.c index 81160176..16dde0ac 100644 --- a/qemu/target/i386/translate.c +++ b/qemu/target/i386/translate.c @@ -5596,6 +5596,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) gen_jr(s, s->T0); break; case 3: /* lcall Ev */ + if (mod == 3) { + goto illegal_op; + } gen_op_ld_v(s, ot, s->T1, s->A0); gen_add_A0_im(s, 1 << ot); gen_op_ld_v(s, MO_16, s->T0, s->A0); @@ -5623,6 +5626,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) gen_jr(s, s->T0); break; case 5: /* ljmp Ev */ + if (mod == 3) { + goto illegal_op; + } gen_op_ld_v(s, ot, s->T1, s->A0); gen_add_A0_im(s, 1 << ot); gen_op_ld_v(s, MO_16, s->T0, s->A0);