fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] quota evasion test and nfs helpers
@ 2026-09-07 16:40 cem
  2026-09-07 16:40 ` [RFC PATCH 1/2] common/nfs: add management helpers cem
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: cem @ 2026-09-07 16:40 UTC (permalink / raw)
  To: zlang; +Cc: djwong, hch, linux-xfs, fstests, jack

From: Carlos Maiolino <cem@kernel.org>

Hi folks.

I'm flagging these as RFC because I'd like an input in the approach I
took here regarding how to setup a local nfs-server to reproduce the bug
recently fixed on xfs quotas.

The issue is regarding how we checked the credentials before proceeding
with quota enforcement / or not. And due the chgrp() being run through a
NSF share, xfs used the wrong credentials allowing an user to evade
quotas.

The TL;DR; for the approach is:
	- setup a xfs fs with an user belonging to two groups with group
	  quotas enforced
	- Setup a local nfs server/client and mount it locally through
	  loopback
	- use the user to fill in the share until it exceeds quota
	- change group of the file to the second group.
	- repeat a couple times until the second group quota is
	  exceeded.

I'm using the already existing user/groups. The tests uses exportfs directly
instead of seeting up a exports file, and I added a few new helpers to
start/stop nfsd and rpcbind. The latter I did as an attempt to make the test
systemd-agnostic. It is working even if nfs-server systemd service is disabled,
but I didn't try on a systemd-less OS.

While writing it I stumped on a weird issue that I'm not exactly sure
how to fix (or if it's perhaps a bug on umount):

During cleanup(), I umount the share and unexport the it so the rest
of the generic cleanup can take place, specially umounting the scratch
fs There is some timing though required by umount() to properly cleanup
internal kernel structures before it can be unexported. I honestly
assumed umount() was synchronous (unless lazy umount) and once it returned
it was "done". But for some reason I didn't dig into, I need to wait a
bit between unmounting the share and unexporting it.
I tried to wait until the mount was excluded from /proc/mounts but even
after the mount is gone, something still holds the share a bit
preventing it to be unexported. So I went with a 2 second sleep :)

Overall the test works, passing on a patched kernel or failing
otherwise.

Comments? Flames? Stones?

Cheers.

Carlos Maiolino (2):
  common/nfs: add management helpers
  generic: add test for quota enforcement via a nfs share

 common/nfs            |  55 ++++++++++++++++++++++
 tests/generic/803     | 106 ++++++++++++++++++++++++++++++++++++++++++
 tests/generic/803.out |   2 +
 3 files changed, 163 insertions(+)
 create mode 100755 tests/generic/803
 create mode 100644 tests/generic/803.out

-- 
2.55.0

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

end of thread, other threads:[~2026-09-10 11:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07 16:40 [RFC PATCH 0/2] quota evasion test and nfs helpers cem
2026-09-07 16:40 ` [RFC PATCH 1/2] common/nfs: add management helpers cem
2026-09-08 14:22   ` Darrick J. Wong
2026-09-09  6:12     ` Christoph Hellwig
2026-09-09 16:13       ` Darrick J. Wong
2026-09-10  9:45         ` Carlos Maiolino
2026-09-10 11:30       ` Jeff Layton
2026-09-10 11:40         ` Carlos Maiolino
2026-09-10 11:48           ` Jeff Layton
2026-09-07 16:40 ` [RFC PATCH 2/2] generic: add test for quota enforcement via a nfs share cem
2026-09-08 10:25   ` Jan Kara
2026-09-08 10:29 ` [RFC PATCH 0/2] quota evasion test and nfs helpers Jan Kara
2026-09-10 11:34 ` Jeff Layton

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 NNTP newsgroup(s).