[PATCH] i386: Improve PLT generation and synthetic PLT symbols

H.J. Lu hjl.tools@gmail.com
Mon May 8 17:06:00 GMT 2017


On Mon, May 8, 2017 at 8:54 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 05/08/2017 05:43 PM, H.J. Lu wrote:
>>>
>>> Yes IMO, LD_AUDIT + -z now should force the GOT entries to remain forever
>>> resolved to the stub PLT entry in a read-only mapping. This however means
>>> keeping around the PLT entries, which is what you're trying to remove,
>>> but
>>> shouldn't without an additional optimization flag.
>>
>>
>> -z now has disabled LD_AUDIT since binutils 2.26.
>
>
> I think this is a bug in binutils 2.26 and later.  I did not realize this at
> the time (my understanding of LD_AUDIT is limited).
>
> We both have large-scale users of LD_AUDIT.  They might be able to migrate
> off x86 before the -z now breakage hits them (keep in mind that we have
> pushed -z now as a recommended hardening flag for a long time), but I
> wouldn't count on that, and I wouldn't want to subject them to that anyway.
>
>>> This is bad. I know of lots of users that are going to be unhappy if we
>>> continue to remove LD_AUDIT support. For now it works in their own
>>> applications,
>>> but I'd like to see LD_AUDIT work with -z now.
>>
>>
>> I didn't see any binutils bug report for this issue.  Also there is no
>> glibc
>> test to check that -z now works with LD_AUDIT.
>
>
> There were, sort of, but you adjusted those tests instead of revisiting the
> binutils change and its impact.  I'm afraid I didn't realize that at the
> time.
>

Here is the binutils change I am checking in.  There is no change
in PLT.  The only externally visible change is the improvement of
synthetic PLT symbols for .plt.got.

Back to the question of -z now, I can change the linker not to use
.plt.got if there are only PLT references to a symbol.  But for

extern void foo (void);

void *
foo_p ()
{
  foo ();
  return foo;
}

I prefer to generate one dynamic relocation for foo, instead of
two, by default.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-i386-Improve-PLT-generation-and-synthetic-PLT-symbol.patch
Type: text/x-patch
Size: 71871 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170508/6f08f957/attachment.bin>


More information about the Binutils mailing list