diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2010-05-20 22:04:25 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-05-20 22:04:25 -0400 |
commit | f503b5ae53cb557ac351a668fcac1baab1cef0db (patch) | |
tree | b2deb02cec90cb18a075b3a49e6de949db374c77 /arch/x86/kernel/traps.c | |
parent | 98ec1878cacb393975cba64f7392eece81716cb4 (diff) |
x86,kgdb: Add low level debug hook
The only way the debugger can handle a trap in inside rcu_lock,
notify_die, or atomic_notifier_call_chain without a triple fault is
to have a low level "first opportunity handler" in the int3 exception
handler.
Generally this will be something the vast majority of folks will not
need, but for those who need it, it is added as a kernel .config
option called KGDB_LOW_LEVEL_TRAP.
CC: Ingo Molnar <mingo@elte.hu>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: H. Peter Anvin <hpa@zytor.com>
CC: x86@kernel.org
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'arch/x86/kernel/traps.c')
-rw-r--r-- | arch/x86/kernel/traps.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 02cfb9b8f5b1..7eaad4c5110a 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kprobes.h> | 15 | #include <linux/kprobes.h> |
16 | #include <linux/uaccess.h> | 16 | #include <linux/uaccess.h> |
17 | #include <linux/kdebug.h> | 17 | #include <linux/kdebug.h> |
18 | #include <linux/kgdb.h> | ||
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
20 | #include <linux/ptrace.h> | 21 | #include <linux/ptrace.h> |
@@ -451,6 +452,11 @@ void restart_nmi(void) | |||
451 | /* May run on IST stack. */ | 452 | /* May run on IST stack. */ |
452 | dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) | 453 | dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) |
453 | { | 454 | { |
455 | #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP | ||
456 | if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) | ||
457 | == NOTIFY_STOP) | ||
458 | return; | ||
459 | #endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */ | ||
454 | #ifdef CONFIG_KPROBES | 460 | #ifdef CONFIG_KPROBES |
455 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) | 461 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) |
456 | == NOTIFY_STOP) | 462 | == NOTIFY_STOP) |