public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] quota: allow unprivileged users to query ID 0 default limits
@ 2026-03-12  9:08 Ravi Singh
  2026-03-12  9:45 ` Andreas Dilger
  2026-03-17  6:59 ` [PATCH v2] xfs: return default quota limits for IDs without a dquot Ravi Singh
  0 siblings, 2 replies; 13+ messages in thread
From: Ravi Singh @ 2026-03-12  9:08 UTC (permalink / raw)
  To: linux-xfs, linux-fsdevel; +Cc: jack, cem, dgc

Default quota limits are stored on the ID 0 dquot record and are
applied by the kernel to all users who have no explicit limits set.
However, check_quotactl_permission() only allows unprivileged users to
query their own user or group quota via Q_GETQUOTA/Q_XGETQUOTA.  This
means unprivileged users cannot discover what default limits apply to
them.

Allow any user to query ID 0's quota via Q_GETQUOTA/Q_XGETQUOTA.
Note that this does expose ID 0's usage counters and timers in
addition to the default limits. This enables userspace tools like
xfs_quota to fetch default limits and display them to unprivileged
users.

This change does not affect Q_XGETNEXTQUOTA, Q_SETQLIM, or any other
quota command -- those still require CAP_SYS_ADMIN.

Signed-off-by: Ravi Singh <ravising@redhat.com>
---
 fs/quota/quota.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 33bacd707..8b21f3c1b 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -42,6 +42,9 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 		if ((type == USRQUOTA && uid_eq(current_euid(), make_kuid(current_user_ns(), id))) ||
 		    (type == GRPQUOTA && in_egroup_p(make_kgid(current_user_ns(), id))))
 			break;
+		 /* Allow unprivileged read of ID 0 (default quota limits) */
+		if (id == 0)
+			break;
 		fallthrough;
 	default:
 		if (!capable(CAP_SYS_ADMIN))
-- 
2.49.0


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

end of thread, other threads:[~2026-03-25  9:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12  9:08 [RFC PATCH] quota: allow unprivileged users to query ID 0 default limits Ravi Singh
2026-03-12  9:45 ` Andreas Dilger
2026-03-17  6:59   ` Ravi Singh
2026-03-17  6:59 ` [PATCH v2] xfs: return default quota limits for IDs without a dquot Ravi Singh
2026-03-17 12:19   ` Jan Kara
2026-03-17 13:31     ` Theodore Tso
2026-03-18 17:29       ` Jan Kara
2026-03-18 22:18         ` Darrick J. Wong
2026-03-19 12:22           ` Jan Kara
2026-03-23 11:25             ` Ravi Singh
2026-03-25  0:16               ` Darrick J. Wong
2026-03-25  5:46                 ` Christoph Hellwig
2026-03-25  9:11                 ` Ravi Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox