Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4795853img; Tue, 26 Mar 2019 17:32:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9mOfSWTlgqT0ctKp6fTBDzwNC+p0fycULG40omwvNx5/VQatYy25rh+iwDwuB3jutpzEe X-Received: by 2002:a17:902:781:: with SMTP id 1mr940894plj.300.1553646747702; Tue, 26 Mar 2019 17:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553646747; cv=none; d=google.com; s=arc-20160816; b=tcwOwlCGfrZdQVJwBBqlgCv8gNlZDB41NFsTLslzzQuuKMziIjwq9XS8PjRTmbPs1a n4aXAtI2bRiKv+KCI89G9kapasW/SLWBoBQeXPnuTM7S5y0W2/oQC4DX3eFWEXNe32+p 8FHg2l8cq1kLv2EQ+tQJvRsPGUQybqKxUr3oY05sjPIdNYMACrr3vfoyEzFfq2B+5MMt EXywV4B84sxNYr7ThsL17gIV98HlYbgw0aJGdQOAd7WFvu6Y7THLKm/X+2WWQeIbFcTG 0v091CK3mUGQnHSvmrWGcoOQB+pBWFBo5SecgYP37VIw61nui+VTBi+OJuk3rzP3a08w kkjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=P8gH+Pay21RQhXXGuawd0y791TI1ly8Sq/77awgYByg=; b=RiaT166GNGTi4XBgXsDi3nyqIf2lNtM1sE80yL6hpY0LsQdRbRFy8NYf+Pp93eRDil ABov/1Plgr1fhl4+AGSZdMrJqYycMBSCVRsc/V5E0M0c3leOGu1j9OY9I2n/Cg7crKzc Cmal+bGi56dYwZJX5HfZHUtpGYIUM9xFz+b/mxgjSx9E9D6TDoYNMApTT6kTl+AaisR+ YiS9Z8tDNlnqa1+cKJFlVdaCrn4deUhkgTVTnkvKMMmjnQeEL66ecfutGMS/Yugigl0x hJ6fJH4oBcwkGnqp4c0tcAADmSyMvVS/gaPNPZK+8YBWdWcCw8ytRTUapwOGtyp1Do1L guLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tbXaUmIH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9si8612765pgc.156.2019.03.26.17.32.12; Tue, 26 Mar 2019 17:32:27 -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=tbXaUmIH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732442AbfC0Abf (ORCPT + 99 others); Tue, 26 Mar 2019 20:31:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:38244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732310AbfC0Abf (ORCPT ); Tue, 26 Mar 2019 20:31:35 -0400 Received: from localhost (mobile-166-137-177-030.mycingular.net [166.137.177.30]) (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 155662075E; Wed, 27 Mar 2019 00:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553646694; bh=dmCrpIIlOeX3Wo5ocEtZ02zBnrBjS5jwNBYJfgk6vFE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tbXaUmIHaE/c7egINaCmkVjniTyEcy2LpIjJIoaDknsQRm0BVCy+Gvhru02ENGBwv xK1qDEr2HXryx1kmb3RZ0RlmRO6uGiPxNt1VxG57A/PApuU/F4/dARYz10Y9uhzkTR 0NtxPaQ8TYY0Asl/w6KCGkKgAJLnmd1XVof6CaA0= Date: Wed, 27 Mar 2019 09:31:30 +0900 From: Greg KH To: Matthew Garrett Cc: jmorris@namei.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, linux-api@vger.kernel.org, luto@kernel.org, Matthew Garrett Subject: Re: [PATCH V31 25/25] debugfs: Disable open() when kernel is locked down Message-ID: <20190327003130.GB27311@kroah.com> References: <20190326182742.16950-1-matthewgarrett@google.com> <20190326182742.16950-26-matthewgarrett@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326182742.16950-26-matthewgarrett@google.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 26, 2019 at 11:27:41AM -0700, Matthew Garrett wrote: > From: Matthew Garrett > > debugfs has not been meaningfully audited in terms of ensuring that > userland cannot trample over the kernel. At Greg's request, disable > access to it entirely when the kernel is locked down. This is done at > open() time rather than init time as the kernel lockdown status may be > made stricter at runtime. > > Signed-off-by: Matthew Garrett > Cc: gregkh@linuxfoundation.org > --- > fs/debugfs/file.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c > index 4fce1da7db23..9ae12ef29ba0 100644 > --- a/fs/debugfs/file.c > +++ b/fs/debugfs/file.c > @@ -142,6 +142,9 @@ static int open_proxy_open(struct inode *inode, struct file *filp) > const struct file_operations *real_fops = NULL; > int r; > > + if (kernel_is_locked_down("debugfs", LOCKDOWN_INTEGRITY)) > + return -EPERM; Why allow all this, why not just abort the registering of the filesystem with the vfs core so it can't even be mounted? thanks, greg k-h