Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp917448ybd; Sat, 22 Jun 2019 18:59:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlkprcawq14nssSe4R0jliZpiP6h5mjb+2PjIy1BcUhWJpLJLWsw3uMTTsWZooCE9NU/SD X-Received: by 2002:a17:902:a60b:: with SMTP id u11mr22502939plq.9.1561255143425; Sat, 22 Jun 2019 18:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561255143; cv=none; d=google.com; s=arc-20160816; b=J9tWcD0Oy1O4CjQ401/5l0AHIABdUKQI2AmnqNtmXGO1s0roszdgiYBZrsc+DLDBa9 fwUhff9ngrgaQyaqK57iEUgFHNXsMqn+t6PMuKSVVSAWBKN+GuRk1FWqg1hiw5jTxQSb LDX60QiLuoF/VShKrQ3dGObMMDWLst7FnV3BnBRMnv4ZANOZRBcnv5XwPVGwE4IsKoH1 bncbEIEr5ju1dUfbXPh3MTXX4JwdOTVrBkdlSQoU2uqNKGaTJrBzfLaDAA8c09nB2WPG wVLfnPrkjqSz8w9WH2doU+c2R8vtgLC/+lZIg6ziy9ana0m6YPKWFdSGFByEFHTEKb+X 3BHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SjUHv9Wdygo/yUWwtIkw/TRt/xlewDSeTP2jTUz2720=; b=iJFfgoSjHOOY7VKxCkOu+v7kLRDOB2tRe0xcy2KndnJ2utitKS2AioPpPG5+He3/9+ UeaJrKDVYG1bg+tzZ8mcCcOyEFkjh+m0l/hZBXVs5qSMK8m46aTXBnLoVuW9GjyDHX7R 4Ev0lBUs7MaZN2/7Bc6a92+8m0ISck7Je2oNJoJlRZp/wpAc/u83Vht+jZB2HnQFH1lZ kC60ye7jD3g7sgbH62Y0BIX3Ze3FQJSgvZn0zTjE3aFwhhxeCzx+KWqiJ3T++a/wwnXS HlXrBqsMbwNoNy15sYt714A1WKrS6ytURwZ3ohpwp803ITiKtBD/8/KdkwGZC7K8j3Sv xIfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ODywlkzv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12si6378956pgo.535.2019.06.22.18.58.13; Sat, 22 Jun 2019 18:59:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ODywlkzv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbfFWB5Y (ORCPT + 99 others); Sat, 22 Jun 2019 21:57:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:42768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbfFWB5Y (ORCPT ); Sat, 22 Jun 2019 21:57:24 -0400 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8275120820; Sun, 23 Jun 2019 01:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561255043; bh=DbHELEFktwFIO3TcwhinuOLMWsirGAILkCkazCNQxF0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ODywlkzvGzHGFBC4/svAr8OFCcBLnRE+Vl7UhoSN9FkuYrfIV5AgaKlp1G8acNi4J FGnS63WbNnagpHhEsOtq4Pf/Gs7MduY51/RF0xy2IgeeIp0RxtHiE8mbs1U3J/fxDi ePBJKSDYvFtzvWwdTwRWVp8B+TyxKBoaQb4kkoQ8= Date: Sun, 23 Jun 2019 10:57:17 +0900 From: Masami Hiramatsu To: Matthew Garrett Cc: jmorris@namei.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Alexei Starovoitov , Matthew Garrett , "Naveen N . Rao" , Anil S Keshavamurthy , davem@davemloft.net, Masami Hiramatsu Subject: Re: [PATCH V34 22/29] Lock down tracing and perf kprobes when in confidentiality mode Message-Id: <20190623105717.7a22195ea66f276c38ae5096@kernel.org> In-Reply-To: <20190622000358.19895-23-matthewgarrett@google.com> References: <20190622000358.19895-1-matthewgarrett@google.com> <20190622000358.19895-23-matthewgarrett@google.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Jun 2019 17:03:51 -0700 Matthew Garrett wrote: > From: David Howells > > Disallow the creation of perf and ftrace kprobes when the kernel is > locked down in confidentiality mode by preventing their registration. > This prevents kprobes from being used to access kernel memory to steal > crypto data, but continues to allow the use of kprobes from signed > modules. Looks (and sounds) good to me. Acked-by: Masami Hiramatsu Thank you, > > Reported-by: Alexei Starovoitov > Signed-off-by: David Howells > Signed-off-by: Matthew Garrett > Cc: Naveen N. Rao > Cc: Anil S Keshavamurthy > Cc: davem@davemloft.net > Cc: Masami Hiramatsu > --- > include/linux/security.h | 1 + > kernel/trace/trace_kprobe.c | 5 +++++ > security/lockdown/lockdown.c | 1 + > 3 files changed, 7 insertions(+) > > diff --git a/include/linux/security.h b/include/linux/security.h > index 3875f6df2ecc..e6e3e2403474 100644 > --- a/include/linux/security.h > +++ b/include/linux/security.h > @@ -96,6 +96,7 @@ enum lockdown_reason { > LOCKDOWN_MMIOTRACE, > LOCKDOWN_INTEGRITY_MAX, > LOCKDOWN_KCORE, > + LOCKDOWN_KPROBES, > LOCKDOWN_CONFIDENTIALITY_MAX, > }; > > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > index 5d5129b05df7..5a76a0f79d48 100644 > --- a/kernel/trace/trace_kprobe.c > +++ b/kernel/trace/trace_kprobe.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > > #include "trace_dynevent.h" > #include "trace_kprobe_selftest.h" > @@ -415,6 +416,10 @@ static int __register_trace_kprobe(struct trace_kprobe *tk) > { > int i, ret; > > + ret = security_locked_down(LOCKDOWN_KPROBES); > + if (ret) > + return ret; > + > if (trace_probe_is_registered(&tk->tp)) > return -EINVAL; > > diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c > index 4c9b324dfc55..5a08c17f224d 100644 > --- a/security/lockdown/lockdown.c > +++ b/security/lockdown/lockdown.c > @@ -32,6 +32,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = { > [LOCKDOWN_MMIOTRACE] = "unsafe mmio", > [LOCKDOWN_INTEGRITY_MAX] = "integrity", > [LOCKDOWN_KCORE] = "/proc/kcore access", > + [LOCKDOWN_KPROBES] = "use of kprobes", > [LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality", > }; > > -- > 2.22.0.410.gd8fdbe21b5-goog > -- Masami Hiramatsu