[LTP] [PATCH v2 2/2] setxattr02: Adapt test for kernel 7.1.0+ socket xattr support
Jan Polensky
japo@linux.ibm.com
Sat Mar 14 16:13:04 CET 2026
Starting with kernel 7.1.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.1.0+.
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
testcases/kernel/syscalls/setxattr/setxattr02.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/setxattr/setxattr02.c b/testcases/kernel/syscalls/setxattr/setxattr02.c
index 9f5f998da9ba..c905f42dbb9e 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr02.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr02.c
@@ -15,7 +15,7 @@
* - EPERM - set attribute to a FIFO
* - EPERM - set attribute to a char special file
* - EPERM - set attribute to a block special file
- * - EPERM - set attribute to a UNIX domain socket
+ * - EPERM/SUCCEED - set attribute to a UNIX domain socket (commit dc0876b9846d)
*/
#include "config.h"
@@ -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 kernels with commit dc0876b9846d */
+ if ((tst_kvercmp(7, 1, 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