Re: [PATCH] debugfs: Fix lockdown check for mmap_prepare
From: Lorenzo Stoakes
Date: Fri Jun 12 2026 - 03:28:45 EST
-cc wrong email
(Please make sure to use my correct email address - ljs@xxxxxxxxxx -
I usually do not see emails sent to the incorrect one)
+From: Chun-Yi Lee <jlee@xxxxxxxx>
(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@xxxxxxxxxxxxxxx
As we will want this backported.
> Signed-off-by: Chun-Yi Lee <jlee@xxxxxxxx>
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@xxxxxxxxxx>
> Cc: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> cc: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Rafael J. Wysocki <rafael@xxxxxxxxxx>
> Cc: Matthew Garrett <matthewgarrett@xxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Danilo Krummrich <dakr@xxxxxxxxxx>
> Cc: driver-core@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> ---
> 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