[PATCH] x86: Disallow APX instruction with length > 15 bytes
H.J. Lu
hjl.tools@gmail.com
Fri Feb 2 11:36:03 GMT 2024
On Thu, Feb 1, 2024 at 11:23 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 01.02.2024 23:47, H.J. Lu wrote:
> > --- a/gas/config/tc-i386.c
> > +++ b/gas/config/tc-i386.c
> > @@ -11772,8 +11772,14 @@ output_insn (const struct last_insn *last_insn)
> > {
> > j = encoding_length (insn_start_frag, insn_start_off, frag_more (0));
> > if (j > 15)
> > - as_warn (_("instruction length of %u bytes exceeds the limit of 15"),
> > - j);
> > + {
> > + if (i.tm.cpu.bitfield.cpuapx_f)
> > + as_bad (_("instruction length of %u bytes exceeds the limit of 15"),
> > + j);
> > + else
> > + as_warn (_("instruction length of %u bytes exceeds the limit of 15"),
> > + j);
> > + }
>
> Why would APX insns be different from others? IOW I continue to think that
No. It is just very easy to generate invalid instructions with APX.
> having a warning here is good enough, uniformly. And it's quite sad that
We ran into this with real codes and triggered run-time errors.
> with introducing APX the limit isn't raised, to accommodate all valid insn
> forms (not considering ones with redundant prefixes, of course). _That_
> would then permit special casing APX here, in _not_ warning anymore.
>
Here is the v2 patch:
https://sourceware.org/pipermail/binutils/2024-February/132285.html
to change warning to error for all instructions.
--
H.J.
More information about the Binutils
mailing list