aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-05-04 12:47:46 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-05-04 12:48:24 -0400
commit33464e3b57834e161add62b499492cf43e35e54c (patch)
treebd78272d5e723fcfd08b2f4d8ce6f7ec7c6c1492
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
[S390] get rid of kprobes notifier call chain.
And here's a port of the powerpc patch to get rid of the notifier chain completely to s390. It's ontop of Martins patch as that one is in mainline already. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/kernel/kprobes.c3
-rw-r--r--arch/s390/mm/fault.c40
-rw-r--r--include/asm-s390/kdebug.h18
-rw-r--r--include/asm-s390/kprobes.h16
4 files changed, 33 insertions, 44 deletions
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 993f35381496..23c61f6d965b 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -516,7 +516,7 @@ out:
516 return 1; 516 return 1;
517} 517}
518 518
519static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 519int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
520{ 520{
521 struct kprobe *cur = kprobe_running(); 521 struct kprobe *cur = kprobe_running();
522 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 522 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
@@ -603,7 +603,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
603 ret = NOTIFY_STOP; 603 ret = NOTIFY_STOP;
604 break; 604 break;
605 case DIE_TRAP: 605 case DIE_TRAP:
606 case DIE_PAGE_FAULT:
607 /* kprobe_running() needs smp_processor_id() */ 606 /* kprobe_running() needs smp_processor_id() */
608 preempt_disable(); 607 preempt_disable();
609 if (kprobe_running() && 608 if (kprobe_running() &&
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;
52extern void die(const char *,struct pt_regs *,long); 52extern void die(const char *,struct pt_regs *,long);
53 53
54#ifdef CONFIG_KPROBES 54#ifdef CONFIG_KPROBES
55static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
56int register_page_fault_notifier(struct notifier_block *nb)
57{
58 return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
59}
60
61int unregister_page_fault_notifier(struct notifier_block *nb)
62{
63 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
64}
65
66static 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(&notify_page_fault_chain,
74 DIE_PAGE_FAULT, &args);
75}
76
77static inline int notify_page_fault(struct pt_regs *regs, long err) 55static 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
84static inline int notify_page_fault(struct pt_regs *regs, long err) 70static 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;
diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h
index 1b50f89819a4..d2d7ad276148 100644
--- a/include/asm-s390/kdebug.h
+++ b/include/asm-s390/kdebug.h
@@ -22,8 +22,21 @@ struct die_args {
22 */ 22 */
23extern int register_die_notifier(struct notifier_block *); 23extern int register_die_notifier(struct notifier_block *);
24extern int unregister_die_notifier(struct notifier_block *); 24extern int unregister_die_notifier(struct notifier_block *);
25extern int register_page_fault_notifier(struct notifier_block *); 25
26extern int unregister_page_fault_notifier(struct notifier_block *); 26/*
27 * These are only here because kprobes.c wants them to implement a
28 * blatant layering violation. Will hopefully go away soon once all
29 * architectures are updated.
30 */
31static inline int register_page_fault_notifier(struct notifier_block *nb)
32{
33 return 0;
34}
35static inline int unregister_page_fault_notifier(struct notifier_block *nb)
36{
37 return 0;
38}
39
27extern struct atomic_notifier_head s390die_chain; 40extern struct atomic_notifier_head s390die_chain;
28 41
29enum die_val { 42enum die_val {
@@ -39,7 +52,6 @@ enum die_val {
39 DIE_GPF, 52 DIE_GPF,
40 DIE_CALL, 53 DIE_CALL,
41 DIE_NMI_IPI, 54 DIE_NMI_IPI,
42 DIE_PAGE_FAULT,
43}; 55};
44 56
45static inline int notify_die(enum die_val val, const char *str, 57static inline int notify_die(enum die_val val, const char *str,
diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h
index b847ff0ec3fa..830fe4c4eea6 100644
--- a/include/asm-s390/kprobes.h
+++ b/include/asm-s390/kprobes.h
@@ -97,18 +97,10 @@ void kretprobe_trampoline(void);
97int is_prohibited_opcode(kprobe_opcode_t *instruction); 97int is_prohibited_opcode(kprobe_opcode_t *instruction);
98void get_instruction_type(struct arch_specific_insn *ainsn); 98void get_instruction_type(struct arch_specific_insn *ainsn);
99 99
100int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
101int kprobe_exceptions_notify(struct notifier_block *self,
102 unsigned long val, void *data);
103
100#define flush_insn_slot(p) do { } while (0) 104#define flush_insn_slot(p) do { } while (0)
101 105
102#endif /* _ASM_S390_KPROBES_H */ 106#endif /* _ASM_S390_KPROBES_H */
103
104#ifdef CONFIG_KPROBES
105
106extern int kprobe_exceptions_notify(struct notifier_block *self,
107 unsigned long val, void *data);
108#else /* !CONFIG_KPROBES */
109static inline int kprobe_exceptions_notify(struct notifier_block *self,
110 unsigned long val, void *data)
111{
112 return 0;
113}
114#endif