Linux driver-core infrastructure
 help / color / mirror / Atom feed
* [PATCH v2] debugfs: Fix lockdown check for mmap_prepare
@ 2026-06-15 10:47 Chun-Yi Lee
  2026-06-15 11:18 ` Lorenzo Stoakes
  0 siblings, 1 reply; 3+ messages in thread
From: Chun-Yi Lee @ 2026-06-15 10:47 UTC (permalink / raw)
  To: Rafael J . Wysocki
  Cc: Chun-Yi Lee, David Howells, Lorenzo Stoakes, Andy Shevchenko,
	Thomas Gleixner, Matthew Garrett, Greg Kroah-Hartman,
	Danilo Krummrich, driver-core, linux-kernel, stable

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

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`.

Since the conversion to `mmap_prepare` across the kernel is not yet
complete, update the lockdown check to look for both `mmap` and
`mmap_prepare` to ensure comprehensive coverage.

Fixes: 651fdda8406d ("relay: update relay to use mmap_prepare")
Signed-off-by: Chun-Yi Lee <jlee@suse.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
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
Cc: stable@vger.kernel.org
---
v2:
- Add explicit From tag to match Signed-off-by.
- Fix Lorenzo's email address.
- Add Cc stable for backporting.
- Check both mmap and mmap_prepare as suggested by Lorenzo.

 fs/debugfs/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index edd6aafbfbaa..08de6652a4f3 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -273,7 +273,8 @@ static int debugfs_locked_down(struct inode *inode,
 	    (!real_fops ||
 	     (!real_fops->unlocked_ioctl &&
 	      !real_fops->compat_ioctl &&
-	      !real_fops->mmap)))
+	      !real_fops->mmap &&
+	      !real_fops->mmap_prepare)))
 		return 0;
 
 	if (security_locked_down(LOCKDOWN_DEBUGFS))
-- 
2.43.0


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

* Re: [PATCH v2] debugfs: Fix lockdown check for mmap_prepare
  2026-06-15 10:47 [PATCH v2] debugfs: Fix lockdown check for mmap_prepare Chun-Yi Lee
@ 2026-06-15 11:18 ` Lorenzo Stoakes
  2026-06-15 14:54   ` joeyli
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Stoakes @ 2026-06-15 11:18 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, stable

On Mon, Jun 15, 2026 at 06:47:50PM +0800, Chun-Yi Lee wrote:
> From: Chun-Yi Lee <jlee@suse.com>
>
> 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`.
>
> Since the conversion to `mmap_prepare` across the kernel is not yet
> complete, update the lockdown check to look for both `mmap` and
> `mmap_prepare` to ensure comprehensive coverage.
>
> Fixes: 651fdda8406d ("relay: update relay to use mmap_prepare")
> Signed-off-by: Chun-Yi Lee <jlee@suse.com>

LGTM so:

Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>

> Cc: David Howells <dhowells@redhat.com>
> Cc: Lorenzo Stoakes <ljs@kernel.org>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Rafael J. Wysocki <rafael@kernel.org>
> Cc: Matthew Garrett <mjg59@srcf.ucam.org>
> 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
> Cc: stable@vger.kernel.org
> ---
> v2:
> - Add explicit From tag to match Signed-off-by.
> - Fix Lorenzo's email address.
> - Add Cc stable for backporting.
> - Check both mmap and mmap_prepare as suggested by Lorenzo.
>
>  fs/debugfs/file.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index edd6aafbfbaa..08de6652a4f3 100644
> --- a/fs/debugfs/file.c
> +++ b/fs/debugfs/file.c
> @@ -273,7 +273,8 @@ static int debugfs_locked_down(struct inode *inode,
>  	    (!real_fops ||
>  	     (!real_fops->unlocked_ioctl &&
>  	      !real_fops->compat_ioctl &&
> -	      !real_fops->mmap)))
> +	      !real_fops->mmap &&
> +	      !real_fops->mmap_prepare)))
>  		return 0;
>
>  	if (security_locked_down(LOCKDOWN_DEBUGFS))
> --
> 2.43.0
>

Cheers, Lorenzo

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

* Re: [PATCH v2] debugfs: Fix lockdown check for mmap_prepare
  2026-06-15 11:18 ` Lorenzo Stoakes
@ 2026-06-15 14:54   ` joeyli
  0 siblings, 0 replies; 3+ messages in thread
From: joeyli @ 2026-06-15 14:54 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, stable

On Mon, Jun 15, 2026 at 12:18:29PM +0100, Lorenzo Stoakes wrote:
> On Mon, Jun 15, 2026 at 06:47:50PM +0800, Chun-Yi Lee wrote:
> > From: Chun-Yi Lee <jlee@suse.com>
> >
> > 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`.
> >
> > Since the conversion to `mmap_prepare` across the kernel is not yet
> > complete, update the lockdown check to look for both `mmap` and
> > `mmap_prepare` to ensure comprehensive coverage.
> >
> > Fixes: 651fdda8406d ("relay: update relay to use mmap_prepare")
> > Signed-off-by: Chun-Yi Lee <jlee@suse.com>
> 
> LGTM so:
> 
> Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
>

Thanks for Lorenzo's review!

Joey Lee

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

end of thread, other threads:[~2026-06-15 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15 10:47 [PATCH v2] debugfs: Fix lockdown check for mmap_prepare Chun-Yi Lee
2026-06-15 11:18 ` Lorenzo Stoakes
2026-06-15 14:54   ` joeyli

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