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: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH v2 1/3] x86-64/ELF: permit relaxed overflow checking for 32-bit PC-relative relocs
Date: Wed, 9 Mar 2022 15:38:58 +0100	[thread overview]
Message-ID: <e74f07f6-e421-38f3-3520-b31bf9c7b97f@suse.com> (raw)
In-Reply-To: <CAMe9rOq=5RKJ3UnhF4nFsF3KWGgbH5Qqmwxcb8LUd5Mm4ihsyg@mail.gmail.com>

On 09.03.2022 15:27, H.J. Lu wrote:
> On Wed, Mar 9, 2022 at 12:21 AM Jan Beulich <jbeulich@suse.com> wrote:
>> On 04.03.2022 15:18, H.J. Lu wrote:
>>> On Fri, Mar 04, 2022 at 02:34:58PM +0100, Jan Beulich wrote:
>>>> --- a/ld/ld.texi
>>>> +++ b/ld/ld.texi
>>>> @@ -1372,6 +1372,12 @@ missing properties in input files.  @opt
>>>>  the linker issue an error for missing properties in input files.
>>>>  Supported for Linux/x86_64.
>>>>
>>>> +@item lax-pcrel-relocs
>>>> +Relax relocation overflow checks for certain 32-bit PC-relative relocations
>>>> +which, when used by 32-bit code inside a 64-bit object, may require a
>>>> +larger range of values to be considered valid.
>>>> +Supported for x86-64 ELF targets.
>>>> +
>>>
>>> I think the check should be turned on automatically.  Can you use a GNU
>>> property bit to tell linker that a larger range of values should be
>>> checked for R_X86_64_PC32
>>
>> I'm not convinced that would be desirable - the relaxed checking, after
>> all, also affects relocations to 64-bit mode. Hence certain overflows
>> won't be detected anymore. Therefore I'd expect people to make use of
>> the new option only if they really have any affected relocations in
>> 32-bit code. Additionally there's no way I can see to set such a
>> property indicator when encountering the relocations in question only
>> in data definitions, unless you wanted to tie the setting of the
>> indicator to the mere use of .code{16,32} anywhere in the source (which
>> would feel way to aggressive to me). IMO this level of control can only
>> be achieved via command line option (without (a) becoming much more
>> intrusive or (b) introducing new relocation types).
> 
> A new relocation type sounds better.

We've been there before with PC16 - there are enough arguments against
introducing new types. I also never had the intention to propose ABI
extensions.

Jan


  reply	other threads:[~2022-03-09 14:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 13:33 [PATCH v2 0/3] x86: another take at PC-relative reloc overflow checking Jan Beulich
2022-03-04 13:34 ` [PATCH v2 1/3] x86-64/ELF: permit relaxed overflow checking for 32-bit PC-relative relocs Jan Beulich
2022-03-04 14:18   ` H.J. Lu
2022-03-09  8:21     ` Jan Beulich
2022-03-09 14:27       ` H.J. Lu
2022-03-09 14:38         ` Jan Beulich [this message]
2022-03-09 15:08           ` H.J. Lu
2022-03-09 15:17             ` Jan Beulich
2022-03-09 15:32               ` H.J. Lu
2022-03-09 15:41                 ` Jan Beulich
2022-03-09 15:54                   ` H.J. Lu
2022-03-09 16:49                     ` Jan Beulich
2022-03-09 18:11                       ` H.J. Lu
2022-03-04 13:35 ` [PATCH v2 2/3] x86-64/ELF: use new reloc override model to deal with x32 special case Jan Beulich
2022-03-04 13:35 ` [PATCH v2 3/3] x86/ELF: permit correct overflow checking for 16-bit PC-relative relocs Jan Beulich

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=e74f07f6-e421-38f3-3520-b31bf9c7b97f@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@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).