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: 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 07:32:50 -0800	[thread overview]
Message-ID: <CAMe9rOojAAz25_GBJLDS-v=zWQyTM6UAb34Ys7ViF2xk+5AU7A@mail.gmail.com> (raw)
In-Reply-To: <d6415fe9-332c-5be7-af05-087a76ae10ce@suse.com>

On Wed, Mar 9, 2022 at 7:17 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 09.03.2022 16:08, H.J. Lu wrote:
> > On Wed, Mar 9, 2022 at 6:39 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>
> >> 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.
> >>
> >
> > A command-line option isn't user friendly.  On the other hand, why
> > now?  The issue has been there forever.
>
> Because earlier on no-one cared to think about the issue? This really
> should have been considered when the ABI was initially written. _That_
> would then also have been the time to introduce separate relocation
> types. Now we need to apply workarounds ...
>

If there is a real issue, we should fix it without a command-line
option.  Can you use the input section name/flags to check it?

-- 
H.J.

  reply	other threads:[~2022-03-09 15:33 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
2022-03-09 15:08           ` H.J. Lu
2022-03-09 15:17             ` Jan Beulich
2022-03-09 15:32               ` H.J. Lu [this message]
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='CAMe9rOojAAz25_GBJLDS-v=zWQyTM6UAb34Ys7ViF2xk+5AU7A@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.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).