This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: ppc64: Call to gettimeofday fails with segfault in __glink_PLTresolve because .plt0 is all zeros.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Date: Fri, 08 Nov 2013 00:46:44 -0500
- Subject: Re: ppc64: Call to gettimeofday fails with segfault in __glink_PLTresolve because .plt0 is all zeros.
- Authentication-results: sourceware.org; auth=none
- References: <52788890 dot 7080608 at redhat dot com> <20131105150331 dot GH20756 at bubble dot grove dot modra dot org> <5279664E dot 6040304 at redhat dot com> <20131105231142 dot GK20756 at bubble dot grove dot modra dot org>
On 11/05/2013 06:11 PM, Alan Modra wrote:
>> Any idea what patch fixed this?
>
> Possibly my 2013-03-28 patches that sort ifunc relocs in .rela.dyn
> after other relocs, but that doesn't seem likely since opd relocs are
> relative and so sort early anyway. Have a look at .rela.dyn in your
> shared library to see whether the ifunc might be called before the opd
> reloc for the ifunc is applied .
Alan,
Just to close the loop here, glibc was returning the address of a
pointer that pointed to the kernel VDSO function as the return
of the IFUNC resolver. The jump slot relocation handling expected
that to be an OPD, and copied 3 double words, two of which were
going to be random other symbols in .bss. Azanella has already
posted a fix for this (use a static OPD within glibc for each VDSO
returned via an IFUNC resolver). We thought binutils was fixed,
but it was just that a patch that changed symbol hash ordering
resulting in the 2 other double words from .bss being variables
whose values were less likely to be zero. No patch to binutils could
make it smart enough to construct an OPD without the appropriate
information :-)
In summary it was a glibc bug which we've fixed.
The pedantically correct fix is for ppc64 vdso to get full OPD
support so _dl_vdso_vsym, when queried for a symbol, can return
the OPD address instead of the function entry point.
Thanks for humouring me.
Cheers,
Carlos.