Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3602843pxb; Mon, 24 Jan 2022 13:16:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2lF3j3KYN8V40SNFQBuy4lztgRwsXmqRhnvwElTmPNNpNXY7nOpIcgWblaf5ZeLgBk+iw X-Received: by 2002:a17:90a:8a02:: with SMTP id w2mr197895pjn.177.1643059008190; Mon, 24 Jan 2022 13:16:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643059008; cv=none; d=google.com; s=arc-20160816; b=EVp/1KEWR4nx1G0XYUnOMfoOpCKWJZ6addcTEVSb8rAqA637cpCIdjDgWjMQ5sp5IX 6HkY8oCw3gusl93y75vYWkbQJEH0II0IeLx/eqSMliRpdFtlkaDwsaHh83Kl9rMDSz80 hB7m8XGNccRUCozOBL9xMeiFdim4jQ2OuK0I59LUOBpo/8cnR6ehYpFQ6Ayc+Wkh8Wx+ UDA2rE+QoGoM3imji3YaT0MgTFmDdL+GbDgixF4j+evINP+iqUCoKtk1jxzE5P7Hmzjs 9One3g4R/u1CGobjPrJh+hLIwcxCe9oQkxfCjbgeAujTY6T5azYIGvnjmEOdd68Vodfe Qkhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RFzwSPklR3s1oOgKD4gIWFZwbvf3fWnREU/F2I+9fgk=; b=V84We12vSmsPxiLY92hyJxuTG25yJbYDnIRZEHD6WiEmZtUrj+vV1nnC+Gn4wTQz9P P5wthA2kMoeBcDx0l4JnMI08vlRaKKrwk9X7Y4KcqHMw6h9TcrgN/wxBtRi6GtKgSxw4 bk83fNmyKz0fUDa7vBl76nqaU2NFDYyPsn13nGM+HvMS8SES8XaGt1O4qgAOGddiHQ8P FcSo5JVxSGKv6k3e8sc4UeuRoHytvO2aFGRtlr40JYjkSpVV8J60psrO/Akan2T16GAP 5PcIYDAUoWRjNBS27Gn3L22cp9ID4eF0d2xwXQ7nHKdny0nSBrFadFwZ8EM9pVA6kB4T 6BgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OImHXflq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si7645194pfv.172.2022.01.24.13.16.36; Mon, 24 Jan 2022 13:16:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OImHXflq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392488AbiAXUvU (ORCPT + 99 others); Mon, 24 Jan 2022 15:51:20 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51730 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383978AbiAXU2F (ORCPT ); Mon, 24 Jan 2022 15:28:05 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60E9E61383; Mon, 24 Jan 2022 20:28:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 457C2C340E5; Mon, 24 Jan 2022 20:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056084; bh=yCS3kdcuvrsLpG2x1smI/oLscK7914Esvp5KKO44Nv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OImHXflqfPZD7FLfzY1PYEEiCkbgdpw1nvJa/9ExwUDQPXNsn3igH+zlUrvhQ6Kny LPDPXHEPRewv7d1Twta02wSQGGg8dSQPb7nNfkbJhPptW5Rc7ivThnaoX/3tU5xVNq zVd/c6oBtjNhcru3U5Ng913ruzs7mP8rlkVJosdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Suchanek , Sasha Levin Subject: [PATCH 5.15 332/846] debugfs: lockdown: Allow reading debugfs files that are not world readable Date: Mon, 24 Jan 2022 19:37:29 +0100 Message-Id: <20220124184112.361816489@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Suchanek [ Upstream commit 358fcf5ddbec4e6706405847d6a666f5933a6c25 ] When the kernel is locked down the kernel allows reading only debugfs files with mode 444. Mode 400 is also valid but is not allowed. Make the 444 into a mask. Fixes: 5496197f9b08 ("debugfs: Restrict debugfs when the kernel is locked down") Signed-off-by: Michal Suchanek Link: https://lore.kernel.org/r/20220104170505.10248-1-msuchanek@suse.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- fs/debugfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 7d162b0efbf03..950c63fa4d0b2 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -147,7 +147,7 @@ static int debugfs_locked_down(struct inode *inode, struct file *filp, const struct file_operations *real_fops) { - if ((inode->i_mode & 07777) == 0444 && + if ((inode->i_mode & 07777 & ~0444) == 0 && !(filp->f_mode & FMODE_WRITE) && !real_fops->unlocked_ioctl && !real_fops->compat_ioctl && -- 2.34.1