From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Brian Norris <briannorris@chromium.org>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] debugfs: Only clobber mode/uid/gid on remount if asked
Date: Fri, 2 Sep 2022 07:45:30 +0200 [thread overview]
Message-ID: <YxGYepQlLZTE84HB@kroah.com> (raw)
In-Reply-To: <YxEy8mTO1nZ1sxHV@google.com>
On Thu, Sep 01, 2022 at 03:32:18PM -0700, Brian Norris wrote:
> On Thu, Sep 01, 2022 at 05:58:14PM +0200, Greg Kroah-Hartman wrote:
> > 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?
>
> I'll admit, my particular userspace in question (Chrom{e,ium}OS) does
> not. There are several debugfs mounts, but they are bind mounts, which
> don't hit this problem.
>
> But Steven hits the nail on the head for most of my reasoning; my main
> motivation is for tracefs (patch 2), whose automount makes this very
> surprising. I included patch 1 for consistency (tracefs essentially
> copy/pasted debugfs). I could drop patch 1 if that helps somehow, but
> I'd still like to consider the automount difficulties in patch 2.
>
> > > 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?
>
> Sorry, this was probably a bit too implied -- the gid changes to its
> default (0 if we never set it in a mount option before; or it will reset
> to any previous gid= mount setting).
>
> # ls -ld /sys/kernel/debug/.
> drwxr-x---. 45 root debugfs-access 0 Dec 31 1969 /sys/kernel/debug/.
> # chown root:power /sys/kernel/debug/
> # ls -ld /sys/kernel/debug/.
> drwxr-x---. 45 root power 0 Dec 31 1969 /sys/kernel/debug/.
> # mount -t debugfs -o uid=power,mode=0750 none /tmp/mnt
> # ls -ld /sys/kernel/debug/.
> drwxr-x---. 45 power debugfs-access 0 Dec 31 1969 /sys/kernel/debug/.
> # mount | grep '\/sys\/kernel\/debug '
> debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime,seclabel,uid=228,gid=605,mode=750)
>
> I can include more before/after examples in the commit message if you
> want. Honestly, that's kind of why I offered to write test cases; test
> cases show what's happening better than narrative descriptions.
before/after in the changelog comments are very good, thanks. And yes,
tests are also good, I'd gladly take that too if you do a v2 of this
patch.
And make it independant of the tracefs change please, these would go
through two different trees as they have different maintainers.
thanks,
greg k-h
next prev parent reply other threads:[~2022-09-02 5:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 0:44 [PATCH 1/2] debugfs: Only clobber mode/uid/gid on remount if asked Brian Norris
2022-08-27 0:44 ` [PATCH 2/2] tracefs: " Brian Norris
2022-09-07 11:44 ` Steven Rostedt
2022-09-07 20:52 ` Brian Norris
2022-09-08 1:25 ` Steven Rostedt
2022-09-07 21:46 ` Steven Rostedt
2022-09-07 21:48 ` Steven Rostedt
2022-09-07 21:53 ` Brian Norris
2022-09-07 22:45 ` Steven Rostedt
2022-09-01 15:58 ` [PATCH 1/2] debugfs: " Greg Kroah-Hartman
2022-09-01 16:11 ` Steven Rostedt
2022-09-01 22:32 ` Brian Norris
2022-09-02 5:45 ` Greg Kroah-Hartman [this message]
2022-09-09 0:16 ` Brian Norris
2022-09-09 0:43 ` Steven Rostedt
2022-09-09 0:57 ` Brian Norris
2022-09-09 1:05 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YxGYepQlLZTE84HB@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=briannorris@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.