This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE


On Wed, May 27, 2009 at 12:30 PM, Ulrich Drepper <drepper@redhat.com> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> H.J. Lu wrote:
>> I got
>>
>> 00000000004005ac <main>:
>>  4005ac:   55           Âpush  %rbp
>>  4005ad:   48 89 e5        Âmov  Â%rsp,%rbp
>>  4005b0:   bf fd ff ff ff     Âmov  Â$0xfffffffd,%edi
>> Â 4005b5: Â Â e8 00 00 00 00 Â Â Â Â Âcallq Â4005ba <main+0xe>
>>  4005ba:   b8 00 00 00 00     Âmov  Â$0x0,%eax
>> Â 4005bf: Â Â c9 Â Â Â Â Â Â Â Â Â Â Âleaveq
>>
>> Relocation section '.rela.ifunc.dyn' at offset 0x430 contains 1 entries:
>>  Offset     ÂInfo      Type      Sym. Value  ÂSym. Name + Addend
>> 0000004005b6 Â000400000002 R_X86_64_PC32 Â Â foo() Â Â Â Â Â Âfoo - 4
>>
>> Dynamic linker will lookup STT_GNU_IFUNC foo and resolve
>> R_X86_64_PC32. But dynamic linker will segfaut as soon as
>> it tries to run foo () since the text segment isn't executable
>> when it is changed to PROT_READ|PROT_WRITE before
>> updating the text segment.
>
> Exactly. ÂWe must never write to a text segment. ÂMaking a text segment
> writable is simply no option. ÂIt's not even possible with the
> appropriate security policy in place.
>
> Really: text relocations are no solutions. ÂEver. ÂNo new extension must
> rely on writable text segments.

I got dynamic executable to work. I will work on static executable.
I will try to put my binutils on git.kernel.org.


H.J.
---
>
>> Certain static executables like kernel may
>> have
>>
>> call STT_GNU_IFUNC foo
>>
>> where the best foo will be selected at boot time for a given hardware.
>> PLT/GOT isn't needed here.
>
> This doesn't matter. ÂEither a PLT slot has a IRELATIVE relocation
> attached (no lookup, no dynamic selection) or it is a traditional PLT
> jump at which point at the first call ld.so will relocate the GOT entry.
>
> - --
> â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkodlNoACgkQ2ijCOnn/RHRblQCdFSUC6y35miwG+KeFCDMu+lKa
> ZWQAn1lZg+KQVQ+NG29OlngxsmQ1grq2
> =fOna
> -----END PGP SIGNATURE-----
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "Generic System V Application Binary Interface" group.
> To post to this group, send email to generic-abi@googlegroups.com
> To unsubscribe from this group, send email to generic-abi+unsubscribe@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/generic-abi?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]