diff options
author | Prasanna S Panchamukhi <prasanna@in.ibm.com> | 2005-09-06 18:19:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:58:00 -0400 |
commit | bb144a85c70a65730424ad1a9dc50fef66e5cafe (patch) | |
tree | eecffdc773b84cd1da172117354c3ade600608d1 /arch/ppc64/kernel/kprobes.c | |
parent | 0f2fbdcbb041f9087da42f8ac2e81f2817098d2a (diff) |
[PATCH] Kprobes: prevent possible race conditions ppc64 changes
This patch contains the ppc64 architecture specific changes to prevent the
possible race conditions.
Signed-off-by: Prasanna S Panchamukhi <prasanna@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc64/kernel/kprobes.c')
-rw-r--r-- | arch/ppc64/kernel/kprobes.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c index a3d519518fb8..591e4b67b5a5 100644 --- a/arch/ppc64/kernel/kprobes.c +++ b/arch/ppc64/kernel/kprobes.c | |||
@@ -44,7 +44,7 @@ static struct kprobe *kprobe_prev; | |||
44 | static unsigned long kprobe_status_prev, kprobe_saved_msr_prev; | 44 | static unsigned long kprobe_status_prev, kprobe_saved_msr_prev; |
45 | static struct pt_regs jprobe_saved_regs; | 45 | static struct pt_regs jprobe_saved_regs; |
46 | 46 | ||
47 | int arch_prepare_kprobe(struct kprobe *p) | 47 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
48 | { | 48 | { |
49 | int ret = 0; | 49 | int ret = 0; |
50 | kprobe_opcode_t insn = *p->addr; | 50 | kprobe_opcode_t insn = *p->addr; |
@@ -68,27 +68,27 @@ int arch_prepare_kprobe(struct kprobe *p) | |||
68 | return ret; | 68 | return ret; |
69 | } | 69 | } |
70 | 70 | ||
71 | void arch_copy_kprobe(struct kprobe *p) | 71 | void __kprobes arch_copy_kprobe(struct kprobe *p) |
72 | { | 72 | { |
73 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 73 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
74 | p->opcode = *p->addr; | 74 | p->opcode = *p->addr; |
75 | } | 75 | } |
76 | 76 | ||
77 | void arch_arm_kprobe(struct kprobe *p) | 77 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
78 | { | 78 | { |
79 | *p->addr = BREAKPOINT_INSTRUCTION; | 79 | *p->addr = BREAKPOINT_INSTRUCTION; |
80 | flush_icache_range((unsigned long) p->addr, | 80 | flush_icache_range((unsigned long) p->addr, |
81 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); | 81 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); |
82 | } | 82 | } |
83 | 83 | ||
84 | void arch_disarm_kprobe(struct kprobe *p) | 84 | void __kprobes arch_disarm_kprobe(struct kprobe *p) |
85 | { | 85 | { |
86 | *p->addr = p->opcode; | 86 | *p->addr = p->opcode; |
87 | flush_icache_range((unsigned long) p->addr, | 87 | flush_icache_range((unsigned long) p->addr, |
88 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); | 88 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); |
89 | } | 89 | } |
90 | 90 | ||
91 | void arch_remove_kprobe(struct kprobe *p) | 91 | void __kprobes arch_remove_kprobe(struct kprobe *p) |
92 | { | 92 | { |
93 | up(&kprobe_mutex); | 93 | up(&kprobe_mutex); |
94 | free_insn_slot(p->ainsn.insn); | 94 | free_insn_slot(p->ainsn.insn); |
@@ -122,7 +122,8 @@ static inline void restore_previous_kprobe(void) | |||
122 | kprobe_saved_msr = kprobe_saved_msr_prev; | 122 | kprobe_saved_msr = kprobe_saved_msr_prev; |
123 | } | 123 | } |
124 | 124 | ||
125 | void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) | 125 | void __kprobes arch_prepare_kretprobe(struct kretprobe *rp, |
126 | struct pt_regs *regs) | ||
126 | { | 127 | { |
127 | struct kretprobe_instance *ri; | 128 | struct kretprobe_instance *ri; |
128 | 129 | ||
@@ -244,7 +245,7 @@ void kretprobe_trampoline_holder(void) | |||
244 | /* | 245 | /* |
245 | * Called when the probe at kretprobe trampoline is hit | 246 | * Called when the probe at kretprobe trampoline is hit |
246 | */ | 247 | */ |
247 | int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | 248 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) |
248 | { | 249 | { |
249 | struct kretprobe_instance *ri = NULL; | 250 | struct kretprobe_instance *ri = NULL; |
250 | struct hlist_head *head; | 251 | struct hlist_head *head; |
@@ -308,7 +309,7 @@ int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
308 | * single-stepped a copy of the instruction. The address of this | 309 | * single-stepped a copy of the instruction. The address of this |
309 | * copy is p->ainsn.insn. | 310 | * copy is p->ainsn.insn. |
310 | */ | 311 | */ |
311 | static void resume_execution(struct kprobe *p, struct pt_regs *regs) | 312 | static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) |
312 | { | 313 | { |
313 | int ret; | 314 | int ret; |
314 | unsigned int insn = *p->ainsn.insn; | 315 | unsigned int insn = *p->ainsn.insn; |
@@ -373,8 +374,8 @@ static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) | |||
373 | /* | 374 | /* |
374 | * Wrapper routine to for handling exceptions. | 375 | * Wrapper routine to for handling exceptions. |
375 | */ | 376 | */ |
376 | int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, | 377 | int __kprobes kprobe_exceptions_notify(struct notifier_block *self, |
377 | void *data) | 378 | unsigned long val, void *data) |
378 | { | 379 | { |
379 | struct die_args *args = (struct die_args *)data; | 380 | struct die_args *args = (struct die_args *)data; |
380 | int ret = NOTIFY_DONE; | 381 | int ret = NOTIFY_DONE; |
@@ -406,7 +407,7 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, | |||
406 | return ret; | 407 | return ret; |
407 | } | 408 | } |
408 | 409 | ||
409 | int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | 410 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) |
410 | { | 411 | { |
411 | struct jprobe *jp = container_of(p, struct jprobe, kp); | 412 | struct jprobe *jp = container_of(p, struct jprobe, kp); |
412 | 413 | ||
@@ -419,16 +420,16 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
419 | return 1; | 420 | return 1; |
420 | } | 421 | } |
421 | 422 | ||
422 | void jprobe_return(void) | 423 | void __kprobes jprobe_return(void) |
423 | { | 424 | { |
424 | asm volatile("trap" ::: "memory"); | 425 | asm volatile("trap" ::: "memory"); |
425 | } | 426 | } |
426 | 427 | ||
427 | void jprobe_return_end(void) | 428 | void __kprobes jprobe_return_end(void) |
428 | { | 429 | { |
429 | }; | 430 | }; |
430 | 431 | ||
431 | int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | 432 | int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) |
432 | { | 433 | { |
433 | /* | 434 | /* |
434 | * FIXME - we should ideally be validating that we got here 'cos | 435 | * FIXME - we should ideally be validating that we got here 'cos |