The reason for kprobe::fault_handler(), as given by their comment:
* We come here because instructions in the pre/post
* handler caused the page_fault, this could happen
* if handler tries to access user space by
* copy_from_user(), get_user() etc. Let the
* user-specified handler try to fix it first.
Is just plain bad. Those other handlers are ran from non-preemptible
context and had better use _nofault() functions. Also, there is no
upstream usage of this.
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
---
Documentation/trace/kprobes.rst | 24 +++++-------------------
arch/arc/kernel/kprobes.c | 10 ----------
arch/arm/probes/kprobes/core.c | 9 ---------
arch/arm64/kernel/probes/kprobes.c | 10 ----------
arch/csky/kernel/probes/kprobes.c | 10 ----------
arch/ia64/kernel/kprobes.c | 9 ---------
arch/mips/kernel/kprobes.c | 3 ---
arch/powerpc/kernel/kprobes.c | 10 ----------
arch/riscv/kernel/probes/kprobes.c | 10 ----------
arch/s390/kernel/kprobes.c | 10 ----------
arch/sh/kernel/kprobes.c | 10 ----------
arch/sparc/kernel/kprobes.c | 10 ----------
arch/x86/kernel/kprobes/core.c | 10 ----------
include/linux/kprobes.h | 8 --------
kernel/kprobes.c | 19 -------------------
samples/kprobes/kprobe_example.c | 15 ---------------
16 files changed, 5 insertions(+), 172 deletions(-)
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -947,16 +947,6 @@ int kprobe_fault_handler(struct pt_regs
* these specific fault cases.
*/
kprobes_inc_nmissed_count(cur);
-
- /*
- * We come here because instructions in the pre/post
- * handler caused the page_fault, this could happen
- * if handler tries to access user space by
- * copy_from_user(), get_user() etc. Let the
- * user-specified handler try to fix it first.
- */
- if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
- return 1;
}