Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4728813img; Tue, 26 Mar 2019 15:48:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoYaTuzaHa3ETCUjjr9Z/mrd+u2oCUE1xgDp926aY2lapqnb4LrtUyJqAapGIMghCDrcff X-Received: by 2002:a63:ad4b:: with SMTP id y11mr17595479pgo.405.1553640531157; Tue, 26 Mar 2019 15:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553640531; cv=none; d=google.com; s=arc-20160816; b=OVeOb0QuN2ClXXuuLB079Lqwv+c8MNvXo+9O9iUp1eiNOpiRSOCmIc9jerWDjc8PcR /51EMhskxTPgSJF6WnjiPat87jG4DDJ9yZX8pyV/BY1vQuLPJCXyRSD9d60SJ9ylrDYi eOENlrecIM3nOrz4sZdA5m3Ib//bZIRiYKru7gRTQ2I4jNMepUl+aoC+HIHUFddyn+ab 83Yt+kOtHwJlfyJP4kD6k1OBGcvDOCmaPreD1yAMeSNltl75o+2o4TO+GGNEdUAU5o2o ELOEoUFwFoKbGd2Rb32s3i1U0ulkNKm4xPSr1Smm9IRC4OM3GTa+VToj5rjThqcv7iAR gE/g== 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=LjCsrP8MCtyzl/y/MFcNiycfpyL3JARmWPo7bypO9Vk=; b=gJCGs0HtABILCPZcOk1kb0HxOkraM5qOvkNcR8RRtxZRw0cnSHEhULnV2D/BJSCk7s /uBDoVqrztIzy+c2a3vnHumHyUrBzkNpWfpMscMVHeLO7lIZOSX2f7HsZtXcjOxaIbOd Zj6o+i9YCWMr8wQEohyvndi9cb3q34qd/PZSOgUHiWUxA6vHVByV1pc3ysPOzbDJWWa8 q6xLoXNSjPKh9w7SUvwsuFScKksOHgthonI9liERT6NYtBzNZ4DZqxpmMsEzcbKb9SyD Qucznm45LxkwNHh4n9ySNqmGMHkx1M5vPjYdNTIPticgNUi1xB8taEFLtfoujcwbgjzZ uWAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0IMccCsP; 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 y184si8879779pgd.423.2019.03.26.15.48.35; Tue, 26 Mar 2019 15:48:51 -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=0IMccCsP; 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 S1731707AbfCZWr7 (ORCPT + 99 others); Tue, 26 Mar 2019 18:47:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:53012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731491AbfCZWr7 (ORCPT ); Tue, 26 Mar 2019 18:47:59 -0400 Received: from devbox (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 415272075D; Tue, 26 Mar 2019 22:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553640478; bh=/dVyfAw2kGjMyWvyu3Vm9/SGL97y96eNhYKN0o3GffM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0IMccCsP8i7vCc+3HTEHDNtyTUlr1YZZKfYCBN1/BJLiixOk7Citw9dU8W702Rc0G Ud6yHO693T0eiiaqyabMSmGzoRHXDirXo2+0Hd3rUfLpk9mp5z2ftpPC4Egv+xltho rfTqEUPe3LOTnkvUmIncYiEse2nIptTLZcQ8dNic= Date: Wed, 27 Mar 2019 07:47:55 +0900 From: Masami Hiramatsu To: Matthew Garrett Cc: James Morris , LSM List , Linux Kernel Mailing List , David Howells , Alexei Starovoitov , "Naveen N . Rao" , Anil S Keshavamurthy , davem@davemloft.net Subject: Re: [PATCH 22/27] Lock down kprobes Message-Id: <20190327074755.310fd73e613a7c0f8fa2d94d@kernel.org> In-Reply-To: References: <20190325220954.29054-1-matthewgarrett@google.com> <20190325220954.29054-23-matthewgarrett@google.com> <20190326212957.f5b518990c14cf21262bfdcc@kernel.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-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 Tue, 26 Mar 2019 10:41:23 -0700 Matthew Garrett wrote: > On Tue, Mar 26, 2019 at 5:30 AM Masami Hiramatsu wrote: > > > > 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. > > Is there any way to install a kprobe /without/ it coming from a > module? The presumption in lockdown mode is that module signing is > enforced, so I'll admit to not being entirely clear on why this patch > is needed in that case. Yes, there are 2 paths, ftrace and perf(bpf). If you want to disable ftrace path (which start from user's input via tracefs), this should be done in trace_kprobe_create()@kernel/trace/trace_kprobe.c. If you want to disable both, __register_trace_kprobe()@kernel/trace/trace_kprobe.c is the best place. Thank you, -- Masami Hiramatsu