diff options
Diffstat (limited to 'arch/s390/mm/fault.c')
-rw-r--r-- | arch/s390/mm/fault.c | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 2b76a879a7b5..91f705adc3f9 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -52,38 +52,24 @@ extern int sysctl_userprocess_debug; | |||
52 | extern void die(const char *,struct pt_regs *,long); | 52 | extern void die(const char *,struct pt_regs *,long); |
53 | 53 | ||
54 | #ifdef CONFIG_KPROBES | 54 | #ifdef CONFIG_KPROBES |
55 | static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); | ||
56 | int register_page_fault_notifier(struct notifier_block *nb) | ||
57 | { | ||
58 | return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); | ||
59 | } | ||
60 | |||
61 | int unregister_page_fault_notifier(struct notifier_block *nb) | ||
62 | { | ||
63 | return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); | ||
64 | } | ||
65 | |||
66 | static int __kprobes __notify_page_fault(struct pt_regs *regs, long err) | ||
67 | { | ||
68 | struct die_args args = { .str = "page fault", | ||
69 | .trapnr = 14, | ||
70 | .signr = SIGSEGV }; | ||
71 | args.regs = regs; | ||
72 | args.err = err; | ||
73 | return atomic_notifier_call_chain(¬ify_page_fault_chain, | ||
74 | DIE_PAGE_FAULT, &args); | ||
75 | } | ||
76 | |||
77 | static inline int notify_page_fault(struct pt_regs *regs, long err) | 55 | static inline int notify_page_fault(struct pt_regs *regs, long err) |
78 | { | 56 | { |
79 | if (unlikely(kprobe_running())) | 57 | int ret = 0; |
80 | return __notify_page_fault(regs, err); | 58 | |
81 | return NOTIFY_DONE; | 59 | /* kprobe_running() needs smp_processor_id() */ |
60 | if (!user_mode(regs)) { | ||
61 | preempt_disable(); | ||
62 | if (kprobe_running() && kprobe_fault_handler(regs, 14)) | ||
63 | ret = 1; | ||
64 | preempt_enable(); | ||
65 | } | ||
66 | |||
67 | return ret; | ||
82 | } | 68 | } |
83 | #else | 69 | #else |
84 | static inline int notify_page_fault(struct pt_regs *regs, long err) | 70 | static inline int notify_page_fault(struct pt_regs *regs, long err) |
85 | { | 71 | { |
86 | return NOTIFY_DONE; | 72 | return 0; |
87 | } | 73 | } |
88 | #endif | 74 | #endif |
89 | 75 | ||
@@ -319,7 +305,7 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int write) | |||
319 | int space; | 305 | int space; |
320 | int si_code; | 306 | int si_code; |
321 | 307 | ||
322 | if (notify_page_fault(regs, error_code) == NOTIFY_STOP) | 308 | if (notify_page_fault(regs, error_code)) |
323 | return; | 309 | return; |
324 | 310 | ||
325 | tsk = current; | 311 | tsk = current; |