[0/3] fix ifunc with static pie [BZ #27072]

Message ID cover.1610016590.git.szabolcs.nagy@arm.com
Headers
Series fix ifunc with static pie [BZ #27072] |

Message

Szabolcs Nagy Jan. 7, 2021, 11 a.m. UTC
  on aarch64 this depends on a patch i posted earlier:
https://sourceware.org/pipermail/libc-alpha/2021-January/121366.html

with that aarch64 static pie tests pass.

i'm still working on the tunables change and thinging about
libc build time checks for reloc-free early startup code.

i havent tested x86, it might need changes.

Szabolcs Nagy (3):
  Make libc symbols hidden in static PIE
  [RFC] elf: hack up tunables to avoid RELATIVE relocs
  csu: Move static pie self relocation later [BZ #27072]

 csu/libc-start.c         | 10 ++++++++++
 elf/dl-tunables.h        |  4 ++--
 include/libc-symbols.h   |  8 ++++++--
 scripts/gen-tunables.awk |  2 +-
 4 files changed, 19 insertions(+), 5 deletions(-)
  

Comments

H.J. Lu Jan. 7, 2021, 12:48 p.m. UTC | #1
On Thu, Jan 7, 2021 at 3:01 AM Szabolcs Nagy via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> on aarch64 this depends on a patch i posted earlier:
> https://sourceware.org/pipermail/libc-alpha/2021-January/121366.html
>
> with that aarch64 static pie tests pass.
>
> i'm still working on the tunables change and thinging about
> libc build time checks for reloc-free early startup code.
>
> i havent tested x86, it might need changes.

Please fix the linker bug:

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

first before changing glibc.
  
Carlos O'Donell Jan. 7, 2021, 12:50 p.m. UTC | #2
On 1/7/21 7:48 AM, H.J. Lu via Libc-alpha wrote:
> On Thu, Jan 7, 2021 at 3:01 AM Szabolcs Nagy via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
>>
>> on aarch64 this depends on a patch i posted earlier:
>> https://sourceware.org/pipermail/libc-alpha/2021-January/121366.html
>>
>> with that aarch64 static pie tests pass.
>>
>> i'm still working on the tunables change and thinging about
>> libc build time checks for reloc-free early startup code.
>>
>> i havent tested x86, it might need changes.
> 
> Please fix the linker bug:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=13302
> 
> first before changing glibc.

You will still need potential changes in the loader to handle
existing binaries, so the binutils fix need not come first,
but it needs fixing.
  
H.J. Lu Jan. 7, 2021, 12:55 p.m. UTC | #3
On Thu, Jan 7, 2021 at 4:50 AM Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 1/7/21 7:48 AM, H.J. Lu via Libc-alpha wrote:
> > On Thu, Jan 7, 2021 at 3:01 AM Szabolcs Nagy via Libc-alpha
> > <libc-alpha@sourceware.org> wrote:
> >>
> >> on aarch64 this depends on a patch i posted earlier:
> >> https://sourceware.org/pipermail/libc-alpha/2021-January/121366.html
> >>
> >> with that aarch64 static pie tests pass.
> >>
> >> i'm still working on the tunables change and thinging about
> >> libc build time checks for reloc-free early startup code.
> >>
> >> i havent tested x86, it might need changes.
> >
> > Please fix the linker bug:
> >
> > https://sourceware.org/bugzilla/show_bug.cgi?id=13302
> >
> > first before changing glibc.
>
> You will still need potential changes in the loader to handle
> existing binaries, so the binutils fix need not come first,

Linker fix may impact how glibc should be changed.

> but it needs fixing.
>

Whatever we do in glibc,  please make it target dependent
and it should be NOP for x86.
  
Szabolcs Nagy Jan. 7, 2021, 1:03 p.m. UTC | #4
The 01/07/2021 04:55, H.J. Lu wrote:
> Whatever we do in glibc,  please make it target dependent
> and it should be NOP for x86.

the current x86 logic is completely broken

it is not valid to do irelative before tunables.
  
H.J. Lu Jan. 7, 2021, 1:15 p.m. UTC | #5
On Thu, Jan 7, 2021 at 5:03 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
>
> The 01/07/2021 04:55, H.J. Lu wrote:
> > Whatever we do in glibc,  please make it target dependent
> > and it should be NOP for x86.
>
> the current x86 logic is completely broken
>
> it is not valid to do irelative before tunables.

Do you have a testcase to show that?
  
Szabolcs Nagy Jan. 7, 2021, 1:28 p.m. UTC | #6
The 01/07/2021 05:15, H.J. Lu wrote:
> On Thu, Jan 7, 2021 at 5:03 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> >
> > The 01/07/2021 04:55, H.J. Lu wrote:
> > > Whatever we do in glibc,  please make it target dependent
> > > and it should be NOP for x86.
> >
> > the current x86 logic is completely broken
> >
> > it is not valid to do irelative before tunables.
> 
> Do you have a testcase to show that?

what's the point of

GLIBC_TUNABLES=glibc.cpu.hwcaps=...

if it does not affect ifunc selection?