This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/18801] PIE binary with STT_GNU_IFUNC symbol and TEXTREL segfaults on x86_64
- From: "hjl.tools at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 10 Aug 2015 20:21:45 +0000
- Subject: [Bug libc/18801] PIE binary with STT_GNU_IFUNC symbol and TEXTREL segfaults on x86_64
- Auto-submitted: auto-generated
- References: <bug-18801-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18801
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Sriraman Tallam from comment #0)
> Created attachment 8500 [details]
> Preserve the original segment's execute permissions when protecting the page
> for writing it.
>
> We have a PIE binary with TEXTREL and a STT_GNU_IFUNC symbol that segfaults
> at start-up.
>
> How to reproduce the problem:
>
> zoo.cc
> -------
> int zoo_1 () {
> return 0;
> }
>
> extern "C"
> void *selector () {
> return (void *)&zoo_1;
> }
>
> int zoo() __attribute__ ((ifunc ("selector")));
>
> int main() {
> return zoo ();
> }
>
> $ g++ -mcmodel=large -pie foo.cc
>
> $readelf -Wta ./a.out | grep TEXTREL
> 0x0000000000000016 (TEXTREL) 0x0
> 0x000000000000001e (FLAGS) TEXTREL
>
> $ ./a.out
> Segmentation Fault
>
> Notes:
> * Use mcmodel=large and -pie to create Text relocations.
Please add the testcase to your patch. Please don't use
__attribute__ ((ifunc ("selector")));
since older compilers don't support it.
--
You are receiving this mail because:
You are on the CC list for the bug.