public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
To: David Howells <dhowells@redhat.com>
Cc: 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: Re: [RFC][PATCH] Lock down kprobes
Date: Thu, 9 Nov 2017 23:00:12 +0530	[thread overview]
Message-ID: <20171109173012.GA23619@in.ibm.com> (raw)
In-Reply-To: <11786.1510246325@warthog.procyon.org.uk>

On Thu, Nov 09, 2017 at 04:52:05PM +0000, David Howells wrote:
> 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?

Yes, this patch will prevent any kprobe registration.

Ananth

> 
> 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))

  reply	other threads:[~2017-11-09 17:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 16:52 [RFC][PATCH] Lock down kprobes David Howells
2017-11-09 17:30 ` Ananth N Mavinakayanahalli [this message]
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=20171109173012.GA23619@in.ibm.com \
    --to=ananth@linux.vnet.ibm.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --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