public inbox for platform-driver-x86@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Michal Suchanek <msuchanek@suse.de>
Cc: linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Matthew Garrett <matthewgarrett@google.com>,
	James Morris <jmorris@namei.org>,
	David Howells <dhowells@redhat.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	acpi4asus-user@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] debugfs: lockdown: Allow reading debugfs files that are not world readable
Date: Wed, 5 Jan 2022 12:51:31 +0100	[thread overview]
Message-ID: <YdWGQ+Kxeo9Q7Kli@kroah.com> (raw)
In-Reply-To: <20220104170505.10248-1-msuchanek@suse.de>

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@suse.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

  reply	other threads:[~2022-01-05 11:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 17:05 [PATCH] debugfs: lockdown: Allow reading debugfs files that are not world readable Michal Suchanek
2022-01-05 11:51 ` Greg Kroah-Hartman [this message]
2022-01-05 13:12   ` Michal Suchánek
2022-01-06 14:48     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YdWGQ+Kxeo9Q7Kli@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=andy.shevchenko@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthewgarrett@google.com \
    --cc=msuchanek@suse.de \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox