Re: [PATCH 1/2] debugfs: Only clobber mode/uid/gid on remount if asked

From: Greg Kroah-Hartman
Date: Thu Sep 01 2022 - 11:58:21 EST


On Fri, Aug 26, 2022 at 05:44:16PM -0700, Brian Norris wrote:
> Users may have explicitly configured their debugfs permissions; we
> shouldn't overwrite those just because a second mount appeared.

What userspace mounts debugfs twice?

> Only clobber if the options were provided at mount time.
>
> # Don't change /sys/kernel/debug/ permissions.
> mount -t debugfs none /mnt/foo
>
> # Change /sys/kernel/debug/ mode and uid, but not gid.
> mount -t debugfs -o uid=bar,mode=0750 none /mnt/baz

So what happens today with this change? Without it?

>
> Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
> ---
> I'm open to writing an LTP test case for this, if that seems like a good
> idea.

If it's really needed, again, why would debugfs be ever mounted more
than once?

thanks,

greg k-h