[LTP] [PATCH v1 1/3] fsetxattr02: Adapt test for kernel 7.0+ socket xattr support

Petr Vorel pvorel@suse.cz
Tue Mar 10 14:25:22 CET 2026


Hi Jan,

> Starting with kernel 7.0.0, sockets support extended attributes in the
> user.* namespace. This behavior was enabled by dc0876b9846d ("xattr: support
> extended attributes on sockets"), which permits user.* xattrs on S_IFSOCK
> inodes (previously rejected with -EPERM).

Good catch, thanks!
Reviewed-by: Petr Vorel <pvorel@suse.cz>

> Adapts the test to expect success (exp_err = 0) instead of EPERM when
> testing fsetxattr(2) on sockets with kernel 7.0+.

> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
>  testcases/kernel/syscalls/fsetxattr/fsetxattr02.c | 4 ++++
>  1 file changed, 4 insertions(+)

> diff --git a/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c b/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
> index 18490a865871..ede86b218ee6 100644
> --- a/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
> +++ b/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
> @@ -158,6 +158,10 @@ static void verify_fsetxattr(unsigned int i)
>  	if (TST_RET == -1 && TST_ERR == EOPNOTSUPP)
>  		tst_brk(TCONF, "fsetxattr(2) not supported");

> +	/* consider newer kernels */
very nit: The commit is obvious. If anything to add, I would add the git hash itself.

Kind regards,
Petr

> +	if ((tst_kvercmp(7, 0, 0) >= 0) && (strncmp(tc[i].fname, SOCK, strlen(SOCK)) == 0))
> +		tc[i].exp_err = 0;
> +
>  	/* success */

>  	if (!tc[i].exp_err) {


More information about the ltp mailing list