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

Petr Vorel pvorel@suse.cz
Mon Jan 27 18:14:41 CET 2025


Hi Cyril, Li,

> 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

> Try to fix the issue by increasing the default value of
> max_user_namespaces by 10.

How about merging this before release? I was able to reproduce:
https://lore.kernel.org/ltp/20241104163845.GA1417282@pevik/

Kind regards,
Petr

> Signed-off-by: Xiao Yang <ice_yangxiao@163.com>
> ---
>  testcases/kernel/syscalls/fanotify/fanotify17.c | 2 +-
>  testcases/kernel/syscalls/getxattr/getxattr05.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

> diff --git a/testcases/kernel/syscalls/fanotify/fanotify17.c b/testcases/kernel/syscalls/fanotify/fanotify17.c
> index 3ecb31b6e..a6206d953 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify17.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify17.c
> @@ -224,7 +224,7 @@ static void setup(void)
>  		user_ns_supported = 0;
>  	} else if (!access(MAX_USERNS, F_OK)) {
>  		SAFE_FILE_SCANF(MAX_USERNS, "%d", &orig_max_userns);
> -		SAFE_FILE_PRINTF(MAX_USERNS, "%d", 10);
> +		SAFE_FILE_PRINTF(MAX_USERNS, "%d", orig_max_userns + 10);
>  	}

>  	/*
> diff --git a/testcases/kernel/syscalls/getxattr/getxattr05.c b/testcases/kernel/syscalls/getxattr/getxattr05.c
> index d9717a695..f1c8e8391 100644
> --- a/testcases/kernel/syscalls/getxattr/getxattr05.c
> +++ b/testcases/kernel/syscalls/getxattr/getxattr05.c
> @@ -156,7 +156,7 @@ static void setup(void)
>  		user_ns_supported = 0;
>  	} else if (!access(MAX_USERNS, F_OK)) {
>  		SAFE_FILE_SCANF(MAX_USERNS, "%d", &orig_max_userns);
> -		SAFE_FILE_PRINTF(MAX_USERNS, "%d", 10);
> +		SAFE_FILE_PRINTF(MAX_USERNS, "%d", orig_max_userns + 10);
>  	}

>  }


More information about the ltp mailing list