From 9d28002b230eb01a5db7aecab263d38bf0d6d6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Thu, 10 Nov 2011 09:36:44 +0200 Subject: libc/x86: fix stack unwinding and backtrace information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When compiled without framepointer, the DWARF-2 CFI data is required for proper stack unwinding. This patch adds the CFI information to: * syscalls (so we get proper backtrace even for release builds) the ebx hack was removed as it would complicate the CFI generation * new thread stub function (so the backtrace is clean for user created threads) Also pads the signal return trampolines separate from other functions. If CFI info was found for signal return code (which seems to happen if it's located right next a valid function), it will not be recognized as signal trampoline (gcc unwinder and gdb check first CFI info, and only if it does not exists it compares the exact opcode sequence to see if we are at signal return code block). This fixes a real crash if thread is cancelled and the cancellation handler fails to detect the signal return frame. Signed-off-by: Timo Teräs Signed-off-by: Natanael Copa --- libc/sysdeps/linux/i386/sigaction.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libc/sysdeps/linux/i386/sigaction.c') diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c index de0c75ded..f9af3f748 100644 --- a/libc/sysdeps/linux/i386/sigaction.c +++ b/libc/sysdeps/linux/i386/sigaction.c @@ -112,6 +112,9 @@ libc_hidden_weak(sigaction) #define RESTORE2(name, syscall) \ __asm__ ( \ ".text\n" \ + ".align 8\n" \ + " nop\n" \ + ".align 16\n" \ "__" #name ":\n" \ " movl $" #syscall ", %eax\n" \ " int $0x80\n" \ @@ -128,6 +131,7 @@ RESTORE(restore_rt, __NR_rt_sigreturn) # define RESTORE2(name, syscall) \ __asm__ ( \ ".text\n" \ + ".align 8\n" \ "__" #name ":\n" \ " popl %eax\n" \ " movl $" #syscall ", %eax\n" \ -- cgit v1.2.3