Re: [PATCH v2] debugfs: Fix lockdown check for mmap_prepare
From: joeyli
Date: Tue Jun 23 2026 - 02:11:57 EST
Hi Disha,
On Fri, Jun 19, 2026 at 04:41:57PM +0530, Disha Goel wrote:
> On 15/06/26 4:17 pm, Chun-Yi Lee wrote:
> > From: Chun-Yi Lee <jlee@xxxxxxxx>
> >
> > 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@xxxxxxxx>
> > Cc: David Howells <dhowells@xxxxxxxxxx>
> > Cc: Lorenzo Stoakes <ljs@xxxxxxxxxx>
> > Cc: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: Rafael J. Wysocki <rafael@xxxxxxxxxx>
> > Cc: Matthew Garrett <mjg59@xxxxxxxxxxxxx>
> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > Cc: Danilo Krummrich <dakr@xxxxxxxxxx>
> > Cc: driver-core@xxxxxxxxxxxxxxx
> > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > Cc: stable@xxxxxxxxxxxxxxx
> > ---
>
> Hi,
>
> I tested this patch on ppc64le with lockdown enabled. It correctly fixes the
> security issue where debugfs files using mmap_prepare were not being
> restricted.
>
> Test: blktrace/001 from blktests (uses relayfs via debugfs)
> - Before patch: blktrace bypassed lockdown and accessed debugfs
> - After patch: blktrace properly blocked from accessing debugfs
>
> Environment:
> Kernel: 7.1.0-rc7
> Lockdown: integrity mode
>
> Feel free to add:
> Tested-by: Disha Goel <disgoel@xxxxxxxxxxxxx>
>
Thanks for your testing!
Joey Lee