This is the mail archive of the mailing list for the glibc 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: ppc64: Call to gettimeofday fails with segfault in __glink_PLTresolve because .plt0 is all zeros.

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 .

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.


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