diff options
Diffstat (limited to 'include/linux/kprobes.h')
-rw-r--r-- | include/linux/kprobes.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 443d9800ca3f..04bdaf01112c 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -458,4 +458,23 @@ static inline bool is_kprobe_optinsn_slot(unsigned long addr) | |||
458 | } | 458 | } |
459 | #endif | 459 | #endif |
460 | 460 | ||
461 | /* Returns true if kprobes handled the fault */ | ||
462 | static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs, | ||
463 | unsigned int trap) | ||
464 | { | ||
465 | if (!kprobes_built_in()) | ||
466 | return false; | ||
467 | if (user_mode(regs)) | ||
468 | return false; | ||
469 | /* | ||
470 | * To be potentially processing a kprobe fault and to be allowed | ||
471 | * to call kprobe_running(), we have to be non-preemptible. | ||
472 | */ | ||
473 | if (preemptible()) | ||
474 | return false; | ||
475 | if (!kprobe_running()) | ||
476 | return false; | ||
477 | return kprobe_fault_handler(regs, trap); | ||
478 | } | ||
479 | |||
461 | #endif /* _LINUX_KPROBES_H */ | 480 | #endif /* _LINUX_KPROBES_H */ |