linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dhowells@redhat.com (David Howells)
To: linux-security-module@vger.kernel.org
Subject: [RFC][PATCH] Lock down kprobes
Date: Thu, 09 Nov 2017 15:31:10 +0000	[thread overview]
Message-ID: <26979.1510241470@warthog.procyon.org.uk> (raw)
In-Reply-To: <20171108163148.GA8882@in.ibm.com>

So this?

Thanks,
David
---
commit b5bb759d5e7f99c357b82b8066a9106b817de965
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.
    
    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))
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-11-09 15:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08 16:21 [RFC][PATCH] Lock down kprobes David Howells
2017-11-08 16:31 ` Ananth N Mavinakayanahalli
2017-11-09 15:31 ` David Howells [this message]
2017-11-09 16:43 ` David Howells
  -- 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-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=26979.1510241470@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-security-module@vger.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;
as well as URLs for NNTP newsgroup(s).