[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YdWGQ+Kxeo9Q7Kli@kroah.com>
Date: Wed, 5 Jan 2022 12:51:31 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Michal Suchanek <msuchanek@...e.de>
Cc: linux-kernel@...r.kernel.org,
"Rafael J. Wysocki" <rafael@...nel.org>,
Matthew Garrett <matthewgarrett@...gle.com>,
James Morris <jmorris@...ei.org>,
David Howells <dhowells@...hat.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
acpi4asus-user@...ts.sourceforge.net,
platform-driver-x86@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] debugfs: lockdown: Allow reading debugfs files that are
not world readable
On Tue, Jan 04, 2022 at 06:05:05PM +0100, Michal Suchanek wrote:
>
> 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 <msuchanek@...e.de>
> ---
> fs/debugfs/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Why has it taken so long for anyone to notice this (2 years!)?
Is that because no one uses the lockdown mode and tries to read debugfs
files?
>
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index 7d162b0efbf0..950c63fa4d0b 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 &&
You are now allowing more than just 0400, is that intentional?
I never understood why files that were 0666 were not able to be read
here as well, why not allow that as well? What was magic about 0444
files?
thanks,
greg k-h
Powered by blists - more mailing lists