Skip to content

Commit 4fdd888

Browse files
mhiramatKAGA-KOKO
authored andcommitted
kprobes: Lock kprobe_mutex while showing kprobe_blacklist
Lock kprobe_mutex while showing kprobe_blacklist to prevent updating the kprobe_blacklist. Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Alexandre Chartre <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 2ef96a5 commit 4fdd888

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kernel/kprobes.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2420,6 +2420,7 @@ static const struct file_operations debugfs_kprobes_operations = {
24202420
/* kprobes/blacklist -- shows which functions can not be probed */
24212421
static void *kprobe_blacklist_seq_start(struct seq_file *m, loff_t *pos)
24222422
{
2423+
mutex_lock(&kprobe_mutex);
24232424
return seq_list_start(&kprobe_blacklist, *pos);
24242425
}
24252426

@@ -2446,10 +2447,15 @@ static int kprobe_blacklist_seq_show(struct seq_file *m, void *v)
24462447
return 0;
24472448
}
24482449

2450+
static void kprobe_blacklist_seq_stop(struct seq_file *f, void *v)
2451+
{
2452+
mutex_unlock(&kprobe_mutex);
2453+
}
2454+
24492455
static const struct seq_operations kprobe_blacklist_seq_ops = {
24502456
.start = kprobe_blacklist_seq_start,
24512457
.next = kprobe_blacklist_seq_next,
2452-
.stop = kprobe_seq_stop, /* Reuse void function */
2458+
.stop = kprobe_blacklist_seq_stop,
24532459
.show = kprobe_blacklist_seq_show,
24542460
};
24552461

0 commit comments

Comments
 (0)