Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4219608img; Tue, 26 Mar 2019 05:30:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfGdOgQPh/l6bizbw7d1s9nFd9PYS938vixIpgVjVUGYOixMV1cIjt7xUa6SH2DQf9GrOa X-Received: by 2002:a65:624c:: with SMTP id q12mr27766787pgv.75.1553603457155; Tue, 26 Mar 2019 05:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553603457; cv=none; d=google.com; s=arc-20160816; b=j4m6yVHk689L35YNLVS/s5QpQxSMNbEafeT15gW6SCmsEZ+z/gGepsT90pvIDL04aJ MfZcKgWkyJ2GqTfKdo5NzUudVDYb3KEw1L0n8YkIYQjWNH8TX+M1BakAirkUYICH9WjZ yM7mbUHn4H3CDuG9qfwEkmTJoRypcK6n1egYiOh+SWP3SOU92MAQoUpe+CE0pU1SmO6Z ubs46dF0WpxeC3QCaiBxRbIClM0+1szzdhIlIsswnYlxM55PVlZUd0QKOh8QzgUfSyBx XcLQJ8y7Q+YiFapCdpm3xDfCLf6IpPykInnBJFFBbIGZ4pirEy4m61InRCh+wU+Fk9h4 6w4Q== 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=MSX3t1i7ArRkrKpPkmt3bi2ljBVBjWef413MfBLaqF4=; b=EQqJlHp0VDkq3mmsAMdviocNR4vs2vvGwgjdAcUlEDrupzv3eYgpqDqsDBs8MHcDzl tTdTkxL3y4LYmVuXvxG7FlDUHKiXoFzzSQy/jN9pGTSnvUkJVVVXDAiEIbyPvyN6fNeZ ngND6JIEyq5YIItvqwHQwX/L83+1iW+vXg53eW8eAW4r+LnUNSzz+pFhX6z8r0iPjTtQ cjReckApevNNkqhhWC96FcWSnyhcHBoCRZxFLqT9Bjaf1uKtYyphOnspOGUNz9jltoeJ 4rC8OA6Q5Xil6kiy/lb8NRSqp+mlayu5j4+IOXXQxLyDA94MFY4mzA639D3DYIw5Jr/z Kv3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xhZC2++N; 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 i93si11560306plb.189.2019.03.26.05.30.41; Tue, 26 Mar 2019 05:30:57 -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=xhZC2++N; 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 S1731374AbfCZMaD (ORCPT + 99 others); Tue, 26 Mar 2019 08:30:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:51540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbfCZMaD (ORCPT ); Tue, 26 Mar 2019 08:30:03 -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 541F32075E; Tue, 26 Mar 2019 12:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553603402; bh=sQM5jiXixK+TRDZp1EAAOo+9HgawHweRTNi+g/sfHoc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=xhZC2++NWBiXNXmdSXrpYb1M0HosHFRHAsRrGl+eSqgsAOxJpxtO7GrXy7xTnJ8bv UJWKjcHU5xyzizH4d/CifKUT7Jmvm7rzMXa1DYFNfqHBdo7e6IL/TvGyaoIpqIkxVO btrP1dkjJOnp828VwDufoLIZ0enWzb8MeOdPLvFs= Date: Tue, 26 Mar 2019 21:29:57 +0900 From: Masami Hiramatsu To: Matthew Garrett Cc: jmorris@namei.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, Alexei Starovoitov , "Naveen N . Rao" , Anil S Keshavamurthy , davem@davemloft.net, Masami Hiramatsu Subject: Re: [PATCH 22/27] Lock down kprobes Message-Id: <20190326212957.f5b518990c14cf21262bfdcc@kernel.org> In-Reply-To: <20190325220954.29054-23-matthewgarrett@google.com> References: <20190325220954.29054-1-matthewgarrett@google.com> <20190325220954.29054-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 Mon, 25 Mar 2019 15:09:49 -0700 Matthew Garrett wrote: > From: David Howells > > 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. Hmm, if you enforce signature check of modules, those modules should be allowed to use kprobes? I think we should introduce some kind of trust inheritance from signed (trusted) modules. 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 > --- > kernel/kprobes.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index f4ddfdd2d07e..6f66cca8e2c6 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -1552,6 +1552,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)) > -- > 2.21.0.392.gf8f6787159e-goog > -- Masami Hiramatsu