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

From: Brian Norris
Date: Wed Sep 07 2022 - 17:53:51 EST


On Wed, Sep 07, 2022 at 05:48:13PM -0400, Steven Rostedt wrote:
> On Wed, 7 Sep 2022 17:46:04 -0400
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > > # Don't change /sys/kernel/tracing/ permissions on automount.
> > > umount /sys/kernel/debug/tracing/
> >
> > BTW, I noticed that the above doesn't do anything. That is,
> > you cannot unmount tracefs from /sys/kernel/debug/tracing.

Actually, it does work, but it's hard to observe. See below.

> I just saw your new email. I guess that's just how you were triggering the
> automount, by unmounting it. Right?

You trimmed the important line:
stat /sys/kernel/debug/tracing/.

It's hard to observe directly that /sys/kernel/debug/tracing is
unmounted, because traditional examination (stat(2), open(2), etc.)
methods will re-trigger the automount. The automount is *supposed* to
appear as if it is always there.

Try these:

umount /sys/kernel/debug/tracing/
grep tracefs /proc/mounts
stat /sys/kernel/debug/tracing/.
grep tracefs /proc/mounts

The first and the second grep will give you different results.

> A lot of assumptions about what people may know ;-)

Yes, I suppose. That's also why I figured I'd write a test case, because
test cases tell you exactly what is meant.

Brian