[LTP] [PATCH v2] syscalls/{fanotify17, getxattr05}: Fix the ENOSPC error

Petr Vorel pvorel@suse.cz
Mon Nov 4 17:38:45 CET 2024


Hi Cyril, Xiao Yang,

> Hi!
> > If the value of max_user_namespaces is set to 10 but more than
> > 10 user namspaces are currently used on system.  In this case,
> > these tests fail with ENOSPC. for example:

> > # lsns -t user -n | wc -l
> > 17

> > # ./fanotify17
> > ...
> > fanotify17.c:174: TINFO: Test #0: Global groups limit in init user ns
> > fanotify17.c:130: TPASS: Created 128 groups - below groups limit (128)
> > fanotify17.c:174: TINFO: Test #1: Global groups limit in privileged user ns
> > fanotify17.c:154: TFAIL: unshare(CLONE_NEWUSER) failed: ENOSPC (28)
> > tst_test.c:452: TBROK: Invalid child (6958) exit value 1

> That's strange the test seems to work for me even if it's over the
> limit.

> $ lsns -t user -n | wc -l
> 14

I'm able to reproduce as well on VM.

I get problems with 9 for fanotify17 ...

# for i in {0..7}; do unshare -U & done

# lsns -t user -n | wc -l
9

# ./fanotify17
...
fanotify17.c:154: TFAIL: unshare(CLONE_NEWUSER) failed: ENOSPC (28)
tst_test.c:452: TBROK: Invalid child (1916) exit value 1

and with 10 for getxattr05:

# unshare -U  &

# lsns -t user -n | wc -l
10

# ./getxattr05
getxattr05.c:88: TPASS: Got same data when acquiring the value of system.posix_acl_access twice
getxattr05.c:88: TPASS: Got same data when acquiring the value of system.posix_acl_access twice
getxattr05.c:88: TPASS: Got same data when acquiring the value of system.posix_acl_access twice

> I suppose that since the test is executed as a root since it has
> .require_root the limits does not apply. It's strange that they apply in
> your case. Which kernel is this?

Testing on 6.12.0-rc4-1.gf83465d-default and 6.11.5-1-default (both openSUSE
Tumbleweed) and 6.9.9-amd64 (Debian).

Yes, root access is required for rw to /proc/sys/user/max_user_namespaces:

getxattr05.c:159: TBROK: Failed to open FILE '/proc/sys/user/max_user_namespaces' for writing: EACCES (13)
getxattr05.c:167: TWARN: Failed to open FILE '/proc/sys/user/max_user_namespaces' for writing: EACCES (13)

Kind regards,
Petr


More information about the ltp mailing list