From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752755AbdKHQVh convert rfc822-to-8bit (ORCPT ); Wed, 8 Nov 2017 11:21:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49590 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752205AbdKHQVg (ORCPT ); Wed, 8 Nov 2017 11:21:36 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S. Miller" , Masami Hiramatsu cc: dhowells@redhat.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC][PATCH] Lock down kprobes MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14322.1510158093.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Wed, 08 Nov 2017 16:21:33 +0000 Message-ID: <14323.1510158093@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 08 Nov 2017 16:21:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 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); }