[LTP] [PATCH v1 2/3] setxattr02: Adapt test for kernel 7.0+ socket xattr support
Jan Polensky
japo@linux.ibm.com
Mon Mar 9 18:20:56 CET 2026
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).
Adapts the test to expect success (exp_err = 0) instead of EPERM when
testing setxattr(2) on sockets with kernel 7.0+.
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
testcases/kernel/syscalls/setxattr/setxattr02.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/testcases/kernel/syscalls/setxattr/setxattr02.c b/testcases/kernel/syscalls/setxattr/setxattr02.c
index 9f5f998da9ba..ac2ad8678d31 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr02.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr02.c
@@ -132,6 +132,10 @@ static void verify_setxattr(unsigned int i)
if (TST_RET == -1 && TST_ERR == EOPNOTSUPP)
tst_brk(TCONF, "setxattr(2) not supported");
+ /* consider newer kernels */
+ 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) {
--
2.53.0
More information about the ltp
mailing list