This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Function calls in my ifunc resolver crash due to unitialized PLT entries.
- From: nisse at lysator dot liu dot se (Niels MÃller)
- To: "Carlos O'Donell" <carlos at systemhalted dot org>
- Cc: "libc-help\ at sourceware dot org" <libc-help at sourceware dot org>, Mark H Weaver <mhw at netris dot org>
- Date: Mon, 22 Jun 2015 14:43:01 +0200
- Subject: Re: Function calls in my ifunc resolver crash due to unitialized PLT entries.
- Authentication-results: sourceware.org; auth=none
- References: <nn8ubcb42u dot fsf at armitage dot lysator dot liu dot se> <CAE2sS1i_-9FTFOHCEYgjoXMri7-kKcvN4R1x4DyyRWXohVZt+g at mail dot gmail dot com> <nn4mm0ashi dot fsf at armitage dot lysator dot liu dot se>
nisse@lysator.liu.se (Niels MÃller) writes:
> I'll try to reproduce. Or maybe Mark can tell you how to reproduce it?
Now I have reproduced the problem. I'm running on a x86_64 debian
gnu/linux system. Not the most recent glibc, it seems I have libc-2.19
(the debian package libc6:amd64, version 2.19-13, built from the
"eglibc" fork). But I think Mark used the real glibc-2.21.
Build nettle-3.1 using ./configure --enable-fat && make && make check.
Then run the test program
$ cat dlopen-test.c
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
int main (int argc, char *argv[])
{
void *handle;
handle = dlopen (argv[1], RTLD_NOW);
if (!handle)
{
fprintf (stderr, "%s\n", dlerror ());
exit (EXIT_FAILURE);
}
dlclose (handle);
exit (EXIT_SUCCESS);
}
$ ./dlopen-test ~/build/nettle-fat/libnettle.so
Segmentation fault
In gdb, it gets as far as
Dump of assembler code for function _nettle_cpuid@plt:
=> 0x00007ffff7601b90 <+0>: jmpq *0x22c842(%rip) # 0x7ffff782e3d8
0x00007ffff7601b96 <+6>: pushq $0x26
0x00007ffff7601b9b <+11>: jmpq 0x7ffff7601920
But the address in that slot is not yet properly relocated,
(gdb) x/gx 0x7ffff782e3d8
0x7ffff782e3d8: 0x0000000000009b96
Regards,
/Niels
--
Niels MÃller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.