public inbox for gnu-gabi@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Generic System V Application Binary Interface
	<generic-abi@googlegroups.com>
Cc: "Carlos O'Donell" <carlos@redhat.com>, gnu-gabi@sourceware.org
Subject: Re: RFC: Audit external function called indirectly via GOT
Date: Mon, 01 Jan 2018 00:00:00 -0000	[thread overview]
Message-ID: <CAMe9rOokAU6eTJbVxKURbyM7CjDxha7G=mZKvgmjyzN7gp3CYA@mail.gmail.com> (raw)
In-Reply-To: <20180322133034.GR3812@bubble.grove.modra.org>

On Thu, Mar 22, 2018 at 6:30 AM, Alan Modra <amodra@gmail.com> wrote:
> On Thu, Mar 22, 2018 at 05:39:18AM -0700, H.J. Lu wrote:
>> On Thu, Mar 22, 2018 at 5:29 AM, Alan Modra <amodra@gmail.com> wrote:
>> > On Wed, Mar 21, 2018 at 10:15:26PM -0700, Cary Coutant wrote:
>> >> If you get rid of the GOT entry, and have the point of call jump
>> >> indirectly through the PLTGOT entry, which is initialized to point to
>> >> part (b) of the PLT entry, everything should work the same as without
>> >> -fno-plt. Essentially, all -fno-plt would do is inline part (a) of the
>> >> PLT entry.
>> >>
>> >> -cary
>> >>
>> >> * I'm using parts (a) and (b) to refer to the two parts of a PLT
>> >> entry: (a) an indirect jump via the PLTGOT entry, and (b) code that
>> >> jumps to the lazy binding routine, passing the JUMP_SLOT index.
>> >
>> > Yes, that essentially is what I've done for -fno-plt on powerpc.
>> > The call stub code is inlined while the rest of the PLT is more or
>> > less unchanged.  So you get all of the usual lazy-binding features
>> > by default, and can use "-z now -z relro" if you want a read-only
>> > PLT.
>> >
>>
>> On x86, PLT is always read-only.  The issue is the writable PLTGOT.
>
> Yes, I do know how the x86 PLT works.  (Or to be more honest, how it
> used to work..)  To be clear, I was using PLT to refer to the whole
> scheme, ie. the code to do an indirect jump (x86 .plt), plus a table
> of addresses (x86 .plt.got), plus code for lazy binding (x86 .plt
> again).  Like x86 the powerpc PLT code to do indirect jumps and lazy
> binding is read-only nowadays.  -fno-plt on powerpc inlines the code
> to do the indirect jump, but leaves the table of addresses and the
> lazy binding code functionally unchanged.
>
>> On x86, -fno-plt removes the writable PLTGOT.
>
> I think that may have been a mistake.  You could have kept .plt.got
> functionally unchanged, giving you a writable .plt.got by default with
> -fno-plt, and read-only when "-z now -z relro".  Just like the usual
> -fplt case.
>

This is done on purpose.  See "Alternate Code Sequences For
Security" chapter on x86-64 psABI version 1.0.

-- 
H.J.

      reply	other threads:[~2018-03-22 13:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-01  0:00 H.J. Lu
2018-01-01  0:00 ` Florian Weimer
2018-01-01  0:00   ` H.J. Lu
2018-01-01  0:00     ` Florian Weimer
2018-01-01  0:00       ` Carlos O'Donell
2018-01-01  0:00         ` Florian Weimer
2018-01-01  0:00           ` H.J. Lu
2018-01-01  0:00           ` Carlos O'Donell
2018-01-01  0:00             ` H.J. Lu
2018-01-01  0:00               ` Carlos O'Donell
2018-01-01  0:00             ` Cary Coutant
2018-01-01  0:00               ` H.J. Lu
2018-01-01  0:00                 ` Cary Coutant
2018-01-01  0:00                   ` H.J. Lu
2018-01-01  0:00                     ` Cary Coutant
2018-01-01  0:00             ` Florian Weimer
2018-01-01  0:00               ` H.J. Lu
2018-01-01  0:00                 ` Florian Weimer
2018-01-01  0:00                   ` H.J. Lu
2018-01-01  0:00     ` Florian Weimer
2018-01-01  0:00       ` H.J. Lu
2018-01-01  0:00         ` Florian Weimer
2018-01-01  0:00 ` Cary Coutant
2018-01-01  0:00   ` Carlos O'Donell
2018-01-01  0:00     ` Cary Coutant
2018-01-01  0:00       ` H.J. Lu
2018-01-01  0:00         ` Cary Coutant
2018-01-01  0:00           ` H.J. Lu
2018-01-01  0:00           ` Cary Coutant
2018-01-01  0:00       ` Alan Modra
2018-01-01  0:00         ` H.J. Lu
2018-01-01  0:00           ` Alan Modra
2018-01-01  0:00             ` 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='CAMe9rOokAU6eTJbVxKURbyM7CjDxha7G=mZKvgmjyzN7gp3CYA@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=carlos@redhat.com \
    --cc=generic-abi@googlegroups.com \
    --cc=gnu-gabi@sourceware.org \
    /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).