Linux driver-core infrastructure
 help / color / mirror / Atom feed
* Re: [PATCH] debugfs: Fix lockdown check for mmap_prepare
       [not found] <20260612055455.16894-1-jlee@suse.com>
@ 2026-06-12  7:28 ` Lorenzo Stoakes
  2026-06-12  8:56   ` joeyli
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Stoakes @ 2026-06-12  7:28 UTC (permalink / raw)
  To: Chun-Yi Lee
  Cc: Rafael J . Wysocki, Chun-Yi Lee, David Howells, Andy Shevchenko,
	Thomas Gleixner, Matthew Garrett, Greg Kroah-Hartman,
	Danilo Krummrich, driver-core, linux-kernel

-cc wrong email

(Please make sure to use my correct email address - ljs@kernel.org -
 I usually do not see emails sent to the incorrect one)

+From: Chun-Yi Lee <jlee@suse.com>

(You're sending from a different email address so you need to explicitly
add a From: xxx tag to match the S-o-b at the top of the message)


On Fri, Jun 12, 2026 at 01:54:55PM +0800, Chun-Yi Lee wrote:
> Commit 651fdda8406d ("relay: update relay to use mmap_prepare")
> changed the `mmap` file operation to `mmap_prepare` for relayfs, but
> the lockdown check in debugfs was not updated accordingly.
>
> This prevents debugfs from being locked down when the kernel is in
> integrity mode if a file uses `mmap_prepare` but not `mmap`.
>
> Update the lockdown check to look for `mmap_prepare` instead of `mmap`
> to fix this.
>
> Fixes: 651fdda8406d ("relay: update relay to use mmap_prepare")

You need to explicitly add:

Cc: stable@vger.kernel.org

As we will want this backported.

> Signed-off-by: Chun-Yi Lee <jlee@suse.com>

I think the idea is correct, but needs tweaking to cover _both_ mmap and
mmap_prepare, until the mmap_prepare conversion is complete, see below.

> Cc: David Howells <dhowells@redhat.com>
> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Rafael J. Wysocki <rafael@kernel.org>
> Cc: Matthew Garrett <matthewgarrett@google.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: driver-core@lists.linux.dev
> Cc: linux-kernel@vger.kernel.org
> ---
>  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 edd6aafbfbaa..d5e187895dd8 100644
> --- a/fs/debugfs/file.c
> +++ b/fs/debugfs/file.c
> @@ -273,7 +273,7 @@ static int debugfs_locked_down(struct inode *inode,
>  	    (!real_fops ||
>  	     (!real_fops->unlocked_ioctl &&
>  	      !real_fops->compat_ioctl &&
> -	      !real_fops->mmap)))
> +	      !real_fops->mmap_prepare)))

This is not only applicable to relayfs.

So while we both have mmap and mmap_prepare, this should be:

-	      !real_fops->mmap)))
+	      !real_fops->mmap &&
+	      !real_fops->mmap_prepare)))


>  		return 0;
>
>  	if (security_locked_down(LOCKDOWN_DEBUGFS))
> --
> 2.43.0
>

Thanks, Lorenzo

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] debugfs: Fix lockdown check for mmap_prepare
  2026-06-12  7:28 ` [PATCH] debugfs: Fix lockdown check for mmap_prepare Lorenzo Stoakes
@ 2026-06-12  8:56   ` joeyli
  0 siblings, 0 replies; 2+ messages in thread
From: joeyli @ 2026-06-12  8:56 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: Chun-Yi Lee, Rafael J . Wysocki, David Howells, Andy Shevchenko,
	Thomas Gleixner, Matthew Garrett, Greg Kroah-Hartman,
	Danilo Krummrich, driver-core, linux-kernel, jlee

Hi Lorenzo, 

Thanks for your review!

On Fri, Jun 12, 2026 at 08:28:29AM +0100, Lorenzo Stoakes wrote:
> -cc wrong email
> 
> (Please make sure to use my correct email address - ljs@kernel.org -
>  I usually do not see emails sent to the incorrect one)
> 
> +From: Chun-Yi Lee <jlee@suse.com>
> 
> (You're sending from a different email address so you need to explicitly
> add a From: xxx tag to match the S-o-b at the top of the message)
>

I will use your kernel.org email address and put From: tag.
 
> 
> On Fri, Jun 12, 2026 at 01:54:55PM +0800, Chun-Yi Lee wrote:
> > Commit 651fdda8406d ("relay: update relay to use mmap_prepare")
> > changed the `mmap` file operation to `mmap_prepare` for relayfs, but
> > the lockdown check in debugfs was not updated accordingly.
> >
> > This prevents debugfs from being locked down when the kernel is in
> > integrity mode if a file uses `mmap_prepare` but not `mmap`.
> >
> > Update the lockdown check to look for `mmap_prepare` instead of `mmap`
> > to fix this.
> >
> > Fixes: 651fdda8406d ("relay: update relay to use mmap_prepare")
> 
> You need to explicitly add:
> 
> Cc: stable@vger.kernel.org
> 
> As we will want this backported.
>

I will add cc. to stable mailing list.
 
> > Signed-off-by: Chun-Yi Lee <jlee@suse.com>
> 
> I think the idea is correct, but needs tweaking to cover _both_ mmap and
> mmap_prepare, until the mmap_prepare conversion is complete, see below.
> 
> > Cc: David Howells <dhowells@redhat.com>
> > Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> > cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Rafael J. Wysocki <rafael@kernel.org>
> > Cc: Matthew Garrett <matthewgarrett@google.com>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Danilo Krummrich <dakr@kernel.org>
> > Cc: driver-core@lists.linux.dev
> > Cc: linux-kernel@vger.kernel.org
> > ---
> >  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 edd6aafbfbaa..d5e187895dd8 100644
> > --- a/fs/debugfs/file.c
> > +++ b/fs/debugfs/file.c
> > @@ -273,7 +273,7 @@ static int debugfs_locked_down(struct inode *inode,
> >  	    (!real_fops ||
> >  	     (!real_fops->unlocked_ioctl &&
> >  	      !real_fops->compat_ioctl &&
> > -	      !real_fops->mmap)))
> > +	      !real_fops->mmap_prepare)))
> 
> This is not only applicable to relayfs.
> 
> So while we both have mmap and mmap_prepare, this should be:
> 
> -	      !real_fops->mmap)))
> +	      !real_fops->mmap &&
> +	      !real_fops->mmap_prepare)))
>

Yes, thanks a lot! I will send v2 patch.

Joey Lee 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-12  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260612055455.16894-1-jlee@suse.com>
2026-06-12  7:28 ` [PATCH] debugfs: Fix lockdown check for mmap_prepare Lorenzo Stoakes
2026-06-12  8:56   ` joeyli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox