summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/i386/sigaction.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-11-10 09:36:44 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2011-12-23 15:49:02 +0100
commit9d28002b230eb01a5db7aecab263d38bf0d6d6c7 (patch)
treef17505b5757bfe08cc8e55f31731f36b6647cdd1 /libc/sysdeps/linux/i386/sigaction.c
parenteb5d129b641c644d82089c3ded3d36288c66123c (diff)
downloaduClibc-alpine-9d28002b230eb01a5db7aecab263d38bf0d6d6c7.tar.bz2
uClibc-alpine-9d28002b230eb01a5db7aecab263d38bf0d6d6c7.tar.xz
libc/x86: fix stack unwinding and backtrace information
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 <timo.teras@iki.fi> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Diffstat (limited to 'libc/sysdeps/linux/i386/sigaction.c')
-rw-r--r--libc/sysdeps/linux/i386/sigaction.c4
1 files changed, 4 insertions, 0 deletions
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" \