public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: wwwhhhyyy333@gmail.com, binutils@sourceware.org
Subject: Re: [PATCH] x86: Disallow APX instruction with length > 15 bytes
Date: Fri, 2 Feb 2024 03:36:03 -0800	[thread overview]
Message-ID: <CAMe9rOoN1km_YAgRVM50aVQvK7pNRbPkODPEAeUnMQ83=5YyXg@mail.gmail.com> (raw)
In-Reply-To: <dd7d585a-fd8c-433a-b00b-48420bf706a6@suse.com>

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.

      reply	other threads:[~2024-02-02 11:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 22:47 H.J. Lu
2024-02-02  7:23 ` Jan Beulich
2024-02-02 11:36   ` H.J. Lu [this message]

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='CAMe9rOoN1km_YAgRVM50aVQvK7pNRbPkODPEAeUnMQ83=5YyXg@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    --cc=wwwhhhyyy333@gmail.com \
    /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 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 read-only IMAP folder(s) and NNTP newsgroup(s).