diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index a72e02bf11353293a3bec6ea9cf891d8f47389ca..711fec8f6379cab1b5c7600f4c93de6f58499ea4 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -951,12 +952,14 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, ret = NOTIFY_STOP; break; case DIE_GPF: - /* kprobe_running() needs smp_processor_id() */ - preempt_disable(); - if (kprobe_running() && + /* + * To be potentially processing a kprobe fault and to + * trust the result from kprobe_running(), we have + * be non-preemptible. + */ + if (!preemptible() && kprobe_running() && kprobe_fault_handler(args->regs, args->trapnr)) ret = NOTIFY_STOP; - preempt_enable(); break; default: break;