public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: wwwhhhyyy333@gmail.com, binutils@sourceware.org
Subject: Re: [PATCH v2] x86: Disallow instructions with length > 15 bytes
Date: Mon, 5 Feb 2024 08:41:37 +0100	[thread overview]
Message-ID: <30194aa4-320b-441a-94ac-419b55544500@suse.com> (raw)
In-Reply-To: <CAMe9rOo==Dj=JgzLEAhykB5GXiD-Lvy-Og+V-83uwe31yFOr2A@mail.gmail.com>

On 02.02.2024 12:49, H.J. Lu wrote:
> On Fri, Feb 2, 2024 at 3:41 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 02.02.2024 12:33, H.J. Lu wrote:
>>> --- a/gas/config/tc-i386.c
>>> +++ b/gas/config/tc-i386.c
>>> @@ -11780,8 +11780,8 @@ 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);
>>> +         as_bad (_("instruction length of %u bytes exceeds the limit of 15"),
>>> +                 j);
>>
>> When taking purely a gas perspective, this may be okay. But I'd like
>> to retain the ability to generate overlong insns (without resorting
>> to .byte), so there wants to be a way to downgrade the error to a
>> warning. This is useful in particular when trying to make testcases
>> for disassemblers or other software decoding insns.
> 
> I am checking it in now and backport it to 2.42 branch.   We can add
> a switch or a directive later to downgrade error to warning.

Putting on the branch should be (have been?) deferred until the complete
solution is in place. 2.42.1 could be cut from it at basically any time,
at which point your change would regress the particular case I've been
mentioning. Furthermore I have to raise two more points:
- The 15-byte limit - while long-standing - being rather arbitrary, it
  could in principle be changed (bumped) at any time (as indicated, I
  think the latest with APX it should be bumped). Whenever such a bump
  occurs, the assembler outright refusing to assemble respective insns
  will be a problem.
- .insn is particularly intended to permit encoding things the assembler
  may not otherwise be able to encode. Therefore the diagnostic there
  ought to be more relaxed than for "ordinary" insns.

Jan

  reply	other threads:[~2024-02-05  7:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 11:33 H.J. Lu
2024-02-02 11:41 ` Jan Beulich
2024-02-02 11:49   ` H.J. Lu
2024-02-05  7:41     ` Jan Beulich [this message]
2024-02-05 15:25       ` H.J. Lu

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=30194aa4-320b-441a-94ac-419b55544500@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.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).