From: David Howells <dhowells@redhat.com>
To: ananth@linux.vnet.ibm.com
Cc: dhowells@redhat.com, alexei.starovoitov@gmail.com,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC][PATCH] Lock down kprobes
Date: Thu, 09 Nov 2017 16:52:05 +0000 [thread overview]
Message-ID: <11786.1510246325@warthog.procyon.org.uk> (raw)
Hi,
I need to lock down kprobes under secure boot conditions as part of the patch
series that can be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=efi-lock-down
Can you tell me that if the attached patch is sufficient to the cause?
Thanks,
David
---
commit ffb3484d6e0f1d625f8e84a6a19c139a28a52499
Author: David Howells <dhowells@redhat.com>
Date: Wed Nov 8 16:14:12 2017 +0000
Lock down kprobes
Disallow the creation of kprobes when the kernel is locked down by
preventing their registration. This prevents kprobes from being used to
access kernel memory, either to make modifications or to steal crypto data.
Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index a1606a4224e1..f06023b0936c 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1530,6 +1530,9 @@ int register_kprobe(struct kprobe *p)
struct module *probed_mod;
kprobe_opcode_t *addr;
+ if (kernel_is_locked_down("Use of kprobes"))
+ return -EPERM;
+
/* Adjust probe address from symbol */
addr = kprobe_addr(p);
if (IS_ERR(addr))
next reply other threads:[~2017-11-09 16:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 16:52 David Howells [this message]
2017-11-09 17:30 ` [RFC][PATCH] Lock down kprobes Ananth N Mavinakayanahalli
2017-11-09 21:54 ` David Howells
2017-11-10 0:38 ` Ananth N Mavinakayanahalli
2017-11-10 1:01 ` Masami Hiramatsu
-- strict thread matches above, loose matches on Subject: below --
2017-11-09 16:44 David Howells
2017-11-09 16:52 ` David Howells
2017-11-08 16:21 David Howells
2017-11-08 16:31 ` Ananth N Mavinakayanahalli
2017-11-09 15:31 ` David Howells
2017-11-09 16:43 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11786.1510246325@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox