lkml.org 
[lkml]   [2020]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/5] Refactor kallsyms_show_value() users for correct cred
Date
Hi,

I'm not sure who should carry this tree (me? Greg? akpm? Linus?), but
it fixes a kernel address exposure bug reported by Dominik Czarnota,
where /sys/modules/*/sections/* contents were visible to uid-0 without
CAP_SYSLOG (e.g. in containers):

This is correct, with CAP_SYSLOG:
# cat /sys/module/*/sections/.*text
0xffffffffc0458000
...

This is broken:
# capsh --drop=CAP_SYSLOG -- -c "cat /sys/module/*/sections/.*text"
0xffffffffc0458000
...

Fixing this required refactoring of several internals, and in the process
uncovered other users of kallsyms_show_value() that were doing checks
during "read" context instead of "open" context. This fixes all of these
cases by plumbing the file->f_cred through to their ultimate checks via
kallsyms_show_value()'s new cred argument.

Testing, reviews, and acks appreciated. :)

Thanks!

-Kees


Kees Cook (5):
kallsyms: Refactor kallsyms_show_value() to take cred
module: Refactor section attr into bin attribute
module: Do not expose section addresses to non-CAP_SYSLOG
kprobes: Do not expose probe addresses to non-CAP_SYSLOG
bpf: Check correct cred for CAP_SYSLOG in bpf_dump_raw_ok()

include/linux/filter.h | 4 +--
include/linux/kallsyms.h | 5 ++--
kernel/bpf/syscall.c | 37 +++++++++++++++------------
kernel/kallsyms.c | 17 ++++++++-----
kernel/kprobes.c | 4 +--
kernel/module.c | 51 ++++++++++++++++++++------------------
net/core/sysctl_net_core.c | 2 +-
7 files changed, 67 insertions(+), 53 deletions(-)

--
2.25.1

\
 
 \ /
  Last update: 2020-07-03 01:27    [W:0.112 / U:1.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site