[PATCH] Disallow copy relocation against protected data symbol

H.J. Lu hjl.tools@gmail.com
Thu Aug 24 16:13:00 GMT 2017


On Wed, Aug 23, 2017 at 10:14 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Aug 23, 2017 at 8:01 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Aug 23, 2017 at 7:52 AM, Michael Matz <matz@suse.de> wrote:
>>> Hi,
>>>
>>> On Wed, 23 Aug 2017, H.J. Lu wrote:
>>>
>>>> >> STV_PROTECTED is meaningful only if there is a dynamic relocation.
>>>> >> When the relocation is already resolved by the linker at run-time via
>>>> >> SYMBOLIC_BIND, the symbol is not preemptable regardless if it is
>>>> >> STV_PROTECTED or not.
>>>> >
>>>> > The symbolic_bind hack is only necessary because protected symbols are
>>>> > broken on x86 and not usable for what they are intended.  In a better
>>>>
>>>> It is the direct result of copy relocation.
>>>
>>> Yes, and the fix is to not do copy relocs for protected symbols, instead
>>> of breaking the reason d'etre for protected visibility.
>>
>> I added GNU_PROPERTY_NO_COPY_ON_PROTECTED to GNU
>> program property.  Compiler can generate reference via GOT and set
>> GNU_PROPERTY_NO_COPY_ON_PROTECTED.    This reminds me
>> to update linker to check GNU_PROPERTY_NO_COPY_ON_PROTECTED.
>>
>
> This is the patch I am checking in.
>

This patch isn't sufficient:

https://sourceware.org/bugzilla/show_bug.cgi?id=21997

Here is patch to disallow copy relocation against protected data symbol
defined in shared object with the NO_COPY_ON_PROTECTED property.

OK for master?

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Disallow-copy-relocation-against-protected-data-symb.patch
Type: text/x-patch
Size: 26756 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170824/a27f9dc1/attachment.bin>


More information about the Binutils mailing list