Linux-XFS Archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: fix scrub stats file permissions
@ 2024-02-24  6:01 Darrick J. Wong
  2024-02-26 10:05 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2024-02-24  6:01 UTC (permalink / raw
  To: Chandan Babu R; +Cc: xfs

From: Darrick J. Wong <djwong@kernel.org>

When the kernel is in lockdown mode, debugfs will only show files that
are world-readable and cannot be written, mmaped, or used with ioctl.
That more or less describes the scrub stats file, except that the
permissions are wrong -- they should be 0444, not 0644.  You can't write
the stats file, so the 0200 makes no sense.

Meanwhile, the clear_stats file is only writable, but it got mode 0400
instead of 0200, which would make more sense.

Fix both files so that they make sense.

Fixes: d7a74cad8f451 ("xfs: track usage statistics of online fsck")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/scrub/stats.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/scrub/stats.c b/fs/xfs/scrub/stats.c
index 12f6ebbda3758..02f7645d0c44a 100644
--- a/fs/xfs/scrub/stats.c
+++ b/fs/xfs/scrub/stats.c
@@ -464,9 +464,9 @@ xchk_stats_register(
 	if (!cs->cs_debugfs)
 		return;
 
-	debugfs_create_file("stats", 0644, cs->cs_debugfs, cs,
+	debugfs_create_file("stats", 0444, cs->cs_debugfs, cs,
 			&scrub_stats_fops);
-	debugfs_create_file("clear_stats", 0400, cs->cs_debugfs, cs,
+	debugfs_create_file("clear_stats", 0200, cs->cs_debugfs, cs,
 			&clear_scrub_stats_fops);
 
 	xchk_timestats_register(cs);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: fix scrub stats file permissions
  2024-02-24  6:01 [PATCH] xfs: fix scrub stats file permissions Darrick J. Wong
@ 2024-02-26 10:05 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2024-02-26 10:05 UTC (permalink / raw
  To: Darrick J. Wong; +Cc: Chandan Babu R, xfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-26 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-24  6:01 [PATCH] xfs: fix scrub stats file permissions Darrick J. Wong
2024-02-26 10:05 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).