提交 6f6b1e04 编写于 作者: F Fernando Luis Vzquez Cao 提交者: Andi Kleen

[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 by Andi Kleen. This patch
      adds fixes not included in his original patch.
[AK: Jan Beulich originally discovered these classes of bugs]
Signed-off-by: NFernando Vazquez <fernando@intellilink.co.jp>
Signed-off-by: NAndi Kleen <ak@suse.de>
上级 e9dff0ee
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mca.h> #include <linux/mca.h>
#include <linux/kprobes.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
...@@ -414,7 +415,8 @@ subsys_initcall(mca_init); ...@@ -414,7 +415,8 @@ subsys_initcall(mca_init);
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static void mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag) static __kprobes void
mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag)
{ {
int slot = mca_dev->slot; int slot = mca_dev->slot;
...@@ -444,7 +446,7 @@ static void mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag) ...@@ -444,7 +446,7 @@ static void mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static int mca_handle_nmi_callback(struct device *dev, void *data) static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data)
{ {
struct mca_device *mca_dev = to_mca_device(dev); struct mca_device *mca_dev = to_mca_device(dev);
unsigned char pos5; unsigned char pos5;
...@@ -462,7 +464,7 @@ static int mca_handle_nmi_callback(struct device *dev, void *data) ...@@ -462,7 +464,7 @@ static int mca_handle_nmi_callback(struct device *dev, void *data)
return 0; return 0;
} }
void mca_handle_nmi(void) void __kprobes mca_handle_nmi(void)
{ {
/* First try - scan the various adapters and see if a specific /* First try - scan the various adapters and see if a specific
* adapter was responsible for the error. * adapter was responsible for the error.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册