diff options
author | Fernando Luis Vázquez Cao <fernando@oss.ntt.co.jp> | 2006-09-26 04:52:36 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:36 -0400 |
commit | 06039754d775d3e48e4a292e4f353321205eff53 (patch) | |
tree | a6abdd9ca0efb34006792e7275c4a2c954b229be /arch/i386/kernel/nmi.c | |
parent | 6f6b1e0477ccb2f25a9b045e38440347d2ce21c8 (diff) |
[PATCH] i386: Disallow kprobes on NMI handlers
A kprobe executes IRET early and that could cause NMI recursion and stack
corruption.
Note: This problem was originally spotted and solved by Andi Kleen in the
x86_64 architecture. This patch is an adaption of his patch for i386.
AK: Merged with current code which was a bit different.
AK: Removed printk in nmi handler that shouldn't be there in the first time
AK: Added missing include.
AK: added KPROBES_END
Signed-off-by: Fernando Vazquez <fernando@intellilink.co.jp>
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386/kernel/nmi.c')
-rw-r--r-- | arch/i386/kernel/nmi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c index 7b9a053effa3..dbda706fdd14 100644 --- a/arch/i386/kernel/nmi.c +++ b/arch/i386/kernel/nmi.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/sysctl.h> | 22 | #include <linux/sysctl.h> |
23 | #include <linux/percpu.h> | 23 | #include <linux/percpu.h> |
24 | #include <linux/dmi.h> | 24 | #include <linux/dmi.h> |
25 | #include <linux/kprobes.h> | ||
25 | 26 | ||
26 | #include <asm/smp.h> | 27 | #include <asm/smp.h> |
27 | #include <asm/nmi.h> | 28 | #include <asm/nmi.h> |
@@ -882,7 +883,7 @@ EXPORT_SYMBOL(touch_nmi_watchdog); | |||
882 | 883 | ||
883 | extern void die_nmi(struct pt_regs *, const char *msg); | 884 | extern void die_nmi(struct pt_regs *, const char *msg); |
884 | 885 | ||
885 | int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason) | 886 | __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) |
886 | { | 887 | { |
887 | 888 | ||
888 | /* | 889 | /* |
@@ -962,8 +963,7 @@ int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason) | |||
962 | * This matches the old behaviour. | 963 | * This matches the old behaviour. |
963 | */ | 964 | */ |
964 | rc = 1; | 965 | rc = 1; |
965 | } else | 966 | } |
966 | printk(KERN_WARNING "Unknown enabled NMI hardware?!\n"); | ||
967 | } | 967 | } |
968 | done: | 968 | done: |
969 | return rc; | 969 | return rc; |