From: Zhao Liu <zhao1.liu@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Andrey Polivoda <apolivodaa433@gmail.com>
Subject: Re: [PATCH 2/3] target/i386/tcg: move validate_vex() before all operand decoding
Date: Wed, 30 Sep 2026 16:30:15 +0800 [thread overview]
Message-ID: <arzIl3Z54sS2FDMa@intel.com> (raw)
In-Reply-To: <20260930065406.738374-3-pbonzini@redhat.com>
On Wed, Sep 30, 2026 at 08:54:05AM +0200, Paolo Bonzini wrote:
> Date: Wed, 30 Sep 2026 08:54:05 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 2/3] target/i386/tcg: move validate_vex() before all
> operand decoding
> X-Mailer: git-send-email 2.55.0
>
> Operand sizes are computed in decode_insn(), because s->rip_offset has to
> be known before decode_modrm() computes a RIP-relative address. However,
> validate_vex() runs later and, for X86_VEX_REPScalar instructions, it must
> be able to turn e->s2 into X86_SIZE_ss or X86_SIZE_sd in presence of a
> memory operand. But right now decode_op_size() has already run, and
> therefore decode->op[2].ot stays MO_128; the instruction therefore
> accesses 16 bytes of memory instead of 4 or 8.
>
> The only user of s->rip_offset is decode_modrm(), which is called from
> decode_ops(), so the size computation can move there, after validate_vex().
> Thanks to the previous patch, the CR0.TS and CR0.EM checks come after
> decode_ops(), so #UD for an invalid VEX.L still has priority over #NM.
>
> This way, when validate_vex() adjusts the X86OpEntry, decode_op_size()
> picks up the result. This behaves as intended by commit b7d4ec4832d
> ("target/i386/tcg: move VEX validation early", 2026-08-26), and fixes
> REPScalar instructions that have a memory operand.
>
> This also applies to unary operations, which need to ignore VEX.L.
> While this could also be fixed by using "dq" for the operand size, it
> is untidy that simply setting "s->vex_l = 0" does not do the right thing.
>
> Fixes: b7d4ec4832d ("target/i386/tcg: move VEX validation early", 2026-08-26)
> Reported-by: Zhao Liu <zhao1.liu@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target/i386/tcg/decode-new.c.inc | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
next prev parent reply other threads:[~2026-09-30 8:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 6:54 [PATCH v2 0/3] target/i386/tcg: fix REPScalar with memory operand Paolo Bonzini
2026-09-30 6:54 ` [PATCH 1/3] target/i386/tcg: extract validate_cr0_exceptions() Paolo Bonzini
2026-09-30 8:29 ` Zhao Liu
2026-09-30 6:54 ` [PATCH 2/3] target/i386/tcg: move validate_vex() before all operand decoding Paolo Bonzini
2026-09-30 8:30 ` Zhao Liu [this message]
2026-09-30 6:54 ` [PATCH 3/3] target/i386/tcg: clarify return value of decode_insn Paolo Bonzini
2026-09-30 8:30 ` Zhao Liu
2026-09-30 19:49 ` Andrey Polivoda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arzIl3Z54sS2FDMa@intel.com \
--to=zhao1.liu@intel.com \
--cc=apolivodaa433@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.