mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Masami Hiramatsu <mhiramat@kernel.org>
Cc: dhowells@redhat.com, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [RFC][PATCH] Lock down kprobes
Date: Wed, 08 Nov 2017 16:21:33 +0000	[thread overview]
Message-ID: <14323.1510158093@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?

---
commit 9b736b76fbd7b23b54b4340e80c66f87df54016c
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.  This
    patch restricts writing to /sys/kernel/debug/tracing/kprobe_events; writing
    to /sys/kernel/debug/kprobes/enabled is disabled by the patch that locks
    down debugfs.
    
    Signed-off-by: David Howells <dhowells@redhat.com>

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 8a907e12b6b9..b44f046d2582 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -907,6 +907,9 @@ static int probes_open(struct inode *inode, struct file *file)
 static ssize_t probes_write(struct file *file, const char __user *buffer,
 			    size_t count, loff_t *ppos)
 {
+	if (kernel_is_locked_down("Use of kprobes"))
+		return -EPERM;
+
 	return traceprobe_probes_write(file, buffer, count, ppos,
 			create_trace_kprobe);
 }

             reply	other threads:[~2017-11-08 16:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08 16:21 David Howells [this message]
2017-11-08 16:31 ` Ananth N Mavinakayanahalli
2017-11-09 15:31 ` David Howells
2017-11-09 16:43 ` David Howells
2017-11-09 16:44 David Howells
2017-11-09 16:52 ` David Howells
2017-11-09 16:52 David Howells
2017-11-09 17:30 ` 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

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=14323.1510158093@warthog.procyon.org.uk \
    --to=dhowells@redhat.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

Powered by JetHome