Skip to content

Commit 60f7bb6

Browse files
committed
kprobes: Do not expose probe addresses to non-CAP_SYSLOG
The kprobe show() functions were using "current"'s creds instead of the file opener's creds for kallsyms visibility. Fix to use seq_file->file->f_cred. Cc: Masami Hiramatsu <[email protected]> Cc: [email protected] Fixes: 81365a9 ("kprobes: Show address of kprobes if kallsyms does") Fixes: ffb9bd6 ("kprobes: Show blacklist addresses as same as kallsyms does") Signed-off-by: Kees Cook <[email protected]>
1 parent b25a7c5 commit 60f7bb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/kprobes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,7 +2448,7 @@ static void report_probe(struct seq_file *pi, struct kprobe *p,
24482448
else
24492449
kprobe_type = "k";
24502450

2451-
if (!kallsyms_show_value(current_cred()))
2451+
if (!kallsyms_show_value(pi->file->f_cred))
24522452
addr = NULL;
24532453

24542454
if (sym)
@@ -2540,7 +2540,7 @@ static int kprobe_blacklist_seq_show(struct seq_file *m, void *v)
25402540
* If /proc/kallsyms is not showing kernel address, we won't
25412541
* show them here either.
25422542
*/
2543-
if (!kallsyms_show_value(current_cred()))
2543+
if (!kallsyms_show_value(m->file->f_cred))
25442544
seq_printf(m, "0x%px-0x%px\t%ps\n", NULL, NULL,
25452545
(void *)ent->start_addr);
25462546
else

0 commit comments

Comments
 (0)