Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144725
b: refs/heads/master
c: 201517a
h: refs/heads/master
i:
  144723: 5b94105
v: v3
  • Loading branch information
Masami Hiramatsu authored and Linus Torvalds committed May 8, 2009
1 parent cf1a5b9 commit eec01ef
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d7a5926978cb109b2db5985c65086483caf9e226
refs/heads/master: 201517a7f3ec497fff545a7659c6c876f89f9054
31 changes: 22 additions & 9 deletions trunk/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,22 @@ struct kprobe __kprobes *get_kprobe(void *addr)
return NULL;
}

/* Arm a kprobe with text_mutex */
static void __kprobes arm_kprobe(struct kprobe *kp)
{
mutex_lock(&text_mutex);
arch_arm_kprobe(kp);
mutex_unlock(&text_mutex);
}

/* Disarm a kprobe with text_mutex */
static void __kprobes disarm_kprobe(struct kprobe *kp)
{
mutex_lock(&text_mutex);
arch_disarm_kprobe(kp);
mutex_unlock(&text_mutex);
}

/*
* Aggregate handlers for multiple kprobes support - these handlers
* take care of invoking the individual kprobe handlers on p->list
Expand Down Expand Up @@ -538,7 +554,7 @@ static int __kprobes add_new_kprobe(struct kprobe *ap, struct kprobe *p)
ap->flags &= ~KPROBE_FLAG_DISABLED;
if (!kprobes_all_disarmed)
/* Arm the breakpoint again. */
arch_arm_kprobe(ap);
arm_kprobe(ap);
}
return 0;
}
Expand Down Expand Up @@ -789,11 +805,8 @@ static int __kprobes __unregister_kprobe_top(struct kprobe *p)
* enabled and not gone - otherwise, the breakpoint would
* already have been removed. We save on flushing icache.
*/
if (!kprobes_all_disarmed && !kprobe_disabled(old_p)) {
mutex_lock(&text_mutex);
arch_disarm_kprobe(p);
mutex_unlock(&text_mutex);
}
if (!kprobes_all_disarmed && !kprobe_disabled(old_p))
disarm_kprobe(p);
hlist_del_rcu(&old_p->hlist);
} else {
if (p->break_handler && !kprobe_gone(p))
Expand All @@ -810,7 +823,7 @@ static int __kprobes __unregister_kprobe_top(struct kprobe *p)
if (!kprobe_disabled(old_p)) {
try_to_disable_aggr_kprobe(old_p);
if (!kprobes_all_disarmed && kprobe_disabled(old_p))
arch_disarm_kprobe(old_p);
disarm_kprobe(old_p);
}
}
return 0;
Expand Down Expand Up @@ -1364,7 +1377,7 @@ int __kprobes disable_kprobe(struct kprobe *kp)
try_to_disable_aggr_kprobe(p);

if (!kprobes_all_disarmed && kprobe_disabled(p))
arch_disarm_kprobe(p);
disarm_kprobe(p);
out:
mutex_unlock(&kprobe_mutex);
return ret;
Expand Down Expand Up @@ -1393,7 +1406,7 @@ int __kprobes enable_kprobe(struct kprobe *kp)
}

if (!kprobes_all_disarmed && kprobe_disabled(p))
arch_arm_kprobe(p);
arm_kprobe(p);

p->flags &= ~KPROBE_FLAG_DISABLED;
if (p != kp)
Expand Down

0 comments on commit eec01ef

Please sign in to comment.