[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200702232638.2946421-1-keescook@chromium.org>
Date: Thu, 2 Jul 2020 16:26:33 -0700
From: Kees Cook <keescook@...omium.org>
To: Dominik Czarnota <dominik.czarnota@...ilofbits.com>
Cc: Kees Cook <keescook@...omium.org>, Jessica Yu <jeyu@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
KP Singh <kpsingh@...omium.org>,
"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Masami Hiramatsu <mhiramat@...nel.org>,
Jakub Kicinski <kuba@...nel.org>,
"Steven Rostedt (VMware)" <rostedt@...dmis.org>,
Dmitry Safonov <0x7f454c46@...il.com>,
Will Deacon <will@...nel.org>,
Alexey Dobriyan <adobriyan@...il.com>,
Marc Zyngier <maz@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Matteo Croce <mcroce@...hat.com>,
Edward Cree <ecree@...arflare.com>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Alexander Lobakin <alobakin@...nk.ru>,
Thomas Richter <tmricht@...ux.ibm.com>,
Ingo Molnar <mingo@...nel.org>, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 0/5] Refactor kallsyms_show_value() users for correct cred
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
Powered by blists - more mailing lists