History

kprobes: Lock kprobe_mutex while showing kprobe_blacklist

Lock kprobe_mutex while showing kprobe_blacklist to prevent updating the kprobe_blacklist.

Masami Hiramatsu committed 6 years ago

Commit 4fdd8881 parent 2ef96a51 file · +7 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/kprobes.c+7−1
@@ -2420,6 +2420,7 @@ static const struct file_operations debugfs_kprobes_operations = { · 2419 unmodified lines
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) · 20 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t