Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3572034pxb; Mon, 24 Jan 2022 12:31:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTuUbyqH39oy8lqBzbSE8dmL3J5Jqy63wj1tXrygEMvevfVjWA9IEIAgnLt3XBjM6yMm94 X-Received: by 2002:a63:8f05:: with SMTP id n5mr12891480pgd.606.1643056277545; Mon, 24 Jan 2022 12:31:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056277; cv=none; d=google.com; s=arc-20160816; b=w4O9Pbx8IetsEnIb5tBSWI4gJUWCkGRR5QHWREXbt4KnNgM2NzwiI+qghXMgJcM6he pxQ31LwQJ+bbJr4amjuvF9imNmBy1/psz9fBKTSWZki3MT7d58wnNCW/lY6fzht296XT kXbLPpVnxdZgwZCjrzbyKOGTBej7ftN6hratJbSyJ9S7PxZ89cMb+6sx9oUBCqJiY77b vkEFHGrcWykG0cvYl9Y0PCFrQ5wt20unbQsa7Ycpbd6K4NJHnQy5/T9JHSlSL9b9OL8/ GWfIPtQqY3ADMj/XNzn8SnUj4A2dfJ6Og8B7iqWkGVnPN4kxb9Skw7adlebmQ81+Ubk5 wfXA== 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=SXk2fygLmzUPSn7yLWW7LThfMdBTfoHW0hJ3IYg8Pz4=; b=c+5c8KKvKot3k9QPm703+9M37Bp1R4FN05W54quH+iyaQx0JZH08e7XEb9hmo26iwj cLrwrkywrP3M4h6DmKesKh5tPOTch1Z+p1G7yEwZmc10g03+GokKl2wT0kWugcDXZF2g o7eJ+8JTFih8X3HqdbVg4MVaOnZHV0ll+mLcwgsF9T4D/3Xvp7aXPfWI9piyQhkXm2Ub Pl7CFT2Ocx9ZYGal5CdDhLSam5ckqRIV+s4Grmm7vdR+m8s2cRcypS6RLVWoLelSYcow 5TlJT/L2tUcuapi5rNxRYfqHH9ssqKL1oZObNBqAKwW2sPZJXFM+vsyjsjRsXFesZ7me WUjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u7t4615p; 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 mu12si665257pjb.0.2022.01.24.12.31.05; Mon, 24 Jan 2022 12:31:17 -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=u7t4615p; 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 S1354168AbiAXTgI (ORCPT + 99 others); Mon, 24 Jan 2022 14:36:08 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57230 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352248AbiAXT34 (ORCPT ); Mon, 24 Jan 2022 14:29:56 -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 766B1614A8; Mon, 24 Jan 2022 19:29:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ADC1C340E5; Mon, 24 Jan 2022 19:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052595; bh=O/qVZZaNBQiKTU8XF9hX2SxNcvEqCW1/ktGfMh8W1do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u7t4615pcgK+kytOpfJzkyLgirFBjQDV43Up3KDH74iONvFq8YDNLUzoxzX/oHZQV +Qp5WfdcI0tsgx6uSTcfu8lDswwzVoHyY3DZN5MXz1QEHS6VL34mvWWAeBv47xN7f4 ceJ2KO9t+6B0tGcPm5BlVQjptVwsHicKu0+DhoMc= 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.4 112/320] debugfs: lockdown: Allow reading debugfs files that are not world readable Date: Mon, 24 Jan 2022 19:41:36 +0100 Message-Id: <20220124183957.523671417@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 a32c5c7dcfd89..da87615ad69a7 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -146,7 +146,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