diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-05-06 17:51:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:13:02 -0400 |
commit | 377fad3acbb7e94ab9942a74e0d9ede8eeb2f039 (patch) | |
tree | 0bf8046bb1fa6ccb51df76b56819dee6b6d7487b /arch/um/sys-x86_64 | |
parent | 5d86456d3852cb95a38d2b23fe01cede54984ba5 (diff) |
uml: kernel segfaults should dump proper registers
If there's a segfault inside the kernel, we want a dump of the registers at
the point of the segfault, not the registers at the point of calling panic or
the last userspace registers.
sig_handler_common_skas now uses a static register set in the case of a
SIGSEGV to avoid messing up the process registers if the segfault turns out to
be non-fatal.
The architecture sigcontext-to-pt_regs copying code was repurposed to copy
data out of the SEGV stack frame.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/sys-x86_64')
-rw-r--r-- | arch/um/sys-x86_64/signal.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index 068006213598..fe8ec04d35bb 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
@@ -20,6 +20,36 @@ | |||
20 | 20 | ||
21 | #include "skas.h" | 21 | #include "skas.h" |
22 | 22 | ||
23 | void copy_sc(union uml_pt_regs *regs, void *from) | ||
24 | { | ||
25 | struct sigcontext *sc = from; | ||
26 | |||
27 | #define GETREG(regs, regno, sc, regname) \ | ||
28 | (regs)->skas.regs[(regno) / sizeof(unsigned long)] = (sc)->regname | ||
29 | |||
30 | GETREG(regs, R8, sc, r8); | ||
31 | GETREG(regs, R9, sc, r9); | ||
32 | GETREG(regs, R10, sc, r10); | ||
33 | GETREG(regs, R11, sc, r11); | ||
34 | GETREG(regs, R12, sc, r12); | ||
35 | GETREG(regs, R13, sc, r13); | ||
36 | GETREG(regs, R14, sc, r14); | ||
37 | GETREG(regs, R15, sc, r15); | ||
38 | GETREG(regs, RDI, sc, rdi); | ||
39 | GETREG(regs, RSI, sc, rsi); | ||
40 | GETREG(regs, RBP, sc, rbp); | ||
41 | GETREG(regs, RBX, sc, rbx); | ||
42 | GETREG(regs, RDX, sc, rdx); | ||
43 | GETREG(regs, RAX, sc, rax); | ||
44 | GETREG(regs, RCX, sc, rcx); | ||
45 | GETREG(regs, RSP, sc, rsp); | ||
46 | GETREG(regs, RIP, sc, rip); | ||
47 | GETREG(regs, EFLAGS, sc, eflags); | ||
48 | GETREG(regs, CS, sc, cs); | ||
49 | |||
50 | #undef GETREG | ||
51 | } | ||
52 | |||
23 | static int copy_sc_from_user_skas(struct pt_regs *regs, | 53 | static int copy_sc_from_user_skas(struct pt_regs *regs, |
24 | struct sigcontext __user *from) | 54 | struct sigcontext __user *from) |
25 | { | 55 | { |