From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7626 invoked by alias); 15 Aug 2010 05:49:16 -0000 Received: (qmail 7591 invoked by uid 48); 15 Aug 2010 05:49:05 -0000 Date: Sun, 15 Aug 2010 05:49:00 -0000 Message-ID: <20100815054905.7590.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/45286] kact.sa_restorer = &restore_rt; in sigaction.c glibc get miss compile with -fPIE on x86_64 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "vapier at gentoo dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg01203.txt.bz2 ------- Comment #6 from vapier at gentoo dot org 2010-08-15 05:49 ------- Created an attachment (id=21479) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21479&action=view) signaler.c register a signal handler that goes though __libc_sigaction(), then trigger that signal and attempt to return. since glibc set the sa_restorer field by reading the data at the address of __rt_sigaction instead of using the address itself, the kernel sets the return address to an invalid address. here is a semi-overly-complicated example: gcc -o signaler signaler.c -static ./signaler set a break point at *sigvtalarm and look at the return address: (gdb) x/1g $rsp 0x7fffffffd1f8: 0x0f0000000fc0c748 that's because gcc generated a mov insn which loaded the 64bits at the address of __restore_rt instead of storing the address of __restore_rt itself: 0000000000000010 <__restore_rt>: 10: 48 c7 c0 0f 00 00 00 mov $0xf,%rax 17: 0f 05 syscall -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45286