[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09b36d06bf75aa8264ea31c76911bbd53ada6ab4.camel@kernel.org>
Date: Mon, 25 Sep 2023 06:24:19 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Xiubo Li <xiubli@...hat.com>,
Max Kellermann <max.kellermann@...os.com>,
Ilya Dryomov <idryomov@...il.com>
Cc: ceph-devel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] fs/ceph/debugfs: make all files world-readable
On Mon, 2023-09-25 at 13:18 +0800, Xiubo Li wrote:
> On 9/22/23 14:25, Max Kellermann wrote:
> > I'd like to be able to run metrics collector processes without special
> > privileges
> >
> > In the kernel, there is a mix of debugfs files being world-readable
> > and not world-readable is; with a naive "git grep", I found 723
> > world-readable debugfs_create_file() calls and 582 calls which were
> > only accessible to privileged processe.
> >
> > From the code, I cannot derive a consistent policy for that, but the
> > ceph statistics seem harmless (and useful) enough.
>
> I am not sure whether will this make sense. Because the 'debug' under
> '/sys/kernel/' is also only accessible by privileged process.
>
> Ilya, Jeff
>
> Any idea ?
>
Yeah, I don't think this makes much sense. At least on my machine:
# stat -c '%A' /sys/kernel/debug
drwx------
Without at least x permissions, an unprivileged user can't pathwalk
through there. Max, how are you testing this?
>
> > Signed-off-by: Max Kellermann <max.kellermann@...os.com>
> > ---
> > fs/ceph/debugfs.c | 18 +++++++++---------
> > 1 file changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
> > index 3904333fa6c3..2abee7e18144 100644
> > --- a/fs/ceph/debugfs.c
> > +++ b/fs/ceph/debugfs.c
> > @@ -429,31 +429,31 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
> > name);
> >
> > fsc->debugfs_mdsmap = debugfs_create_file("mdsmap",
> > - 0400,
> > + 0444,
> > fsc->client->debugfs_dir,
> > fsc,
> > &mdsmap_fops);
> >
> > fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions",
> > - 0400,
> > + 0444,
> > fsc->client->debugfs_dir,
> > fsc,
> > &mds_sessions_fops);
> >
> > fsc->debugfs_mdsc = debugfs_create_file("mdsc",
> > - 0400,
> > + 0444,
> > fsc->client->debugfs_dir,
> > fsc,
> > &mdsc_fops);
> >
> > fsc->debugfs_caps = debugfs_create_file("caps",
> > - 0400,
> > + 0444,
> > fsc->client->debugfs_dir,
> > fsc,
> > &caps_fops);
> >
> > fsc->debugfs_status = debugfs_create_file("status",
> > - 0400,
> > + 0444,
> > fsc->client->debugfs_dir,
> > fsc,
> > &status_fops);
> > @@ -461,13 +461,13 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
> > fsc->debugfs_metrics_dir = debugfs_create_dir("metrics",
> > fsc->client->debugfs_dir);
> >
> > - debugfs_create_file("file", 0400, fsc->debugfs_metrics_dir, fsc,
> > + debugfs_create_file("file", 0444, fsc->debugfs_metrics_dir, fsc,
> > &metrics_file_fops);
> > - debugfs_create_file("latency", 0400, fsc->debugfs_metrics_dir, fsc,
> > + debugfs_create_file("latency", 0444, fsc->debugfs_metrics_dir, fsc,
> > &metrics_latency_fops);
> > - debugfs_create_file("size", 0400, fsc->debugfs_metrics_dir, fsc,
> > + debugfs_create_file("size", 0444, fsc->debugfs_metrics_dir, fsc,
> > &metrics_size_fops);
> > - debugfs_create_file("caps", 0400, fsc->debugfs_metrics_dir, fsc,
> > + debugfs_create_file("caps", 0444, fsc->debugfs_metrics_dir, fsc,
> > &metrics_caps_fops);
> > }
> >
>
--
Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists