Skip to contentSkip to conversation

LTP: adjust socket xattr tests for kernel 7.0+; add .editorconfig

PATCH Superseded Jan Polensky 2 participants 8 messages Mar 9 – Mar 11

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover LTP: adjust socket xattr tests for kernel 7.0+; add .editorconfig

Linux 7.0 allows user.* xattrs on sockets (dc0876b9846d). Update fsetxattr02/setxattr02 to expect success on 7.0+ (instead of -EPERM).

Add .editorconfig for consistent formatting.

Jan Polensky (3):
fsetxattr02: Adapt test for kernel 7.0+ socket xattr support
setxattr02: Adapt test for kernel 7.0+ socket xattr support
editorconfig: add consistent formatting rules for LTP

 .editorconfig                                 | 36 +++++++++++++++++++
 .../kernel/syscalls/fsetxattr/fsetxattr02.c   |  4 +++
 .../kernel/syscalls/setxattr/setxattr02.c     |  4 +++
 3 files changed, 44 insertions(+)
 create mode 100644 .editorconfig

--
2.53.0

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 1/3 fsetxattr02: Adapt test for kernel 7.0+ socket xattr support

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 fsetxattr(2) on sockets with kernel 7.0+.

---
 testcases/kernel/syscalls/fsetxattr/fsetxattr02.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/fsetxattr/fsetxattr02.c +4 -0
index 18490a865871..ede86b218ee6 100644
@@ -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 */
+	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) {
Signature · 5 lines
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/3
#2 lore raw

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

Hi Jan,

Quoted 4 lines

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!

Quoted 13 lines

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

---
 testcases/kernel/syscalls/fsetxattr/fsetxattr02.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/fsetxattr/fsetxattr02.c +0 -0
index 18490a865871..ede86b218ee6 100644

testcases/kernel/syscalls/fsetxattr/fsetxattr02.c static void verify_fsetxattr(unsigned int i) · line 161

Quoted 4 lines
testcases/kernel/syscalls/fsetxattr/fsetxattr02.c +1 -0
@@ -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

Quoted 6 lines
testcases/kernel/syscalls/fsetxattr/fsetxattr02.c +3 -0
+	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) {
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

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

Hi Jan,

Quoted 6 lines

Hi Jan,

Quoted 4 lines

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).

I double checked kernel version for dc0876b9846d.

$ git tag --contains dc0876b9846d3d48bb8528332106d1b051578a02
next-20260305
next-20260306
next-20260309

=> IMHO it will be for v7.1. And indeed, current LTP master works on openSUSE 7.0.0-rc2-2.g0bfc1b0-default kernel and fails with your patch.

Quoted 19 lines

Good catch, thanks!

Quoted 15 lines

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

---
 testcases/kernel/syscalls/fsetxattr/fsetxattr02.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/fsetxattr/fsetxattr02.c +0 -0
index 18490a865871..ede86b218ee6 100644
@@ -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");
Quoted 8 lines

testcases/kernel/syscalls/fsetxattr/fsetxattr02.c static void verify_fsetxattr(unsigned int i) · line 161

Quoted 1 line
testcases/kernel/syscalls/fsetxattr/fsetxattr02.c +1 -0
+	/* consider newer kernels */

very nit: The commit is obvious. If anything to add, I would add the git hash itself.

Kind regards,
Petr

testcases/kernel/syscalls/fsetxattr/fsetxattr02.c static void verify_fsetxattr(unsigned int i) · line 163

Quoted 2 lines
testcases/kernel/syscalls/fsetxattr/fsetxattr02.c +2 -0
+	if ((tst_kvercmp(7, 0, 0) >= 0) && (strncmp(tc[i].fname, SOCK, strlen(SOCK)) == 0))
+		tc[i].exp_err = 0;

It should be tst_kvercmp(7, 1, 0) >= 0

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

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

On Tue, Mar 10, 2026 at 02:36:39PM +0100, Petr Vorel wrote:
Hi Peter,

Quoted 4 lines

Hi Jan,

Quoted 1 line

Hi Jan,

[snip]

Quoted 11 lines

I double checked kernel version for dc0876b9846d.

$ git tag --contains dc0876b9846d3d48bb8528332106d1b051578a02
next-20260305
next-20260306
next-20260309

=> IMHO it will be for v7.1. And indeed, current LTP master works on openSUSE 7.0.0-rc2-2.g0bfc1b0-default kernel and fails with your patch.

[snip]

Quoted 5 lines

It should be tst_kvercmp(7, 1, 0) >= 0

Kind regards,
Petr

thank you for the hints. I’ll take them all into account, revise the patches accordingly, and send out a v2 shortly.

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

PATCH 2/3 setxattr02: Adapt test for kernel 7.0+ socket xattr support

In reply to Jan Polensky

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+.

---
 testcases/kernel/syscalls/setxattr/setxattr02.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/setxattr/setxattr02.c +4 -0
index 9f5f998da9ba..ac2ad8678d31 100644
@@ -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) {
Signature · 5 lines
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

PATCH 3/3 editorconfig: add consistent formatting rules for LTP

In reply to Jan Polensky

Introduce .editorconfig to keep indentation and whitespace consistent across editors, preventing accidental reformatting and noisy diffs.

---
 .editorconfig | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 .editorconfig
.editorconfig new file +36 -0
new file mode 100644
index 000000000000..ee9f49516e53
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+# EditorConfig configuration for LTP
+# https://editorconfig.org/
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+# C/Assembly source files, headers, and Makefiles use tabs
+[*.{c,h,mk,S,sh,awk}]
+indent_style = tab
+indent_size = 8
+
+[{Makefile,Makefile.*}]
+indent_style = tab
+indent_size = 8
+
+# Python and Perl scripts use spaces
+[*.{py,pl}]
+indent_style = space
+indent_size = 4
+
+# Documentation files
+[*.{rst,md}]
+indent_style = space
+indent_size = 3
+
+# JSON files
+[*.json]
+indent_style = space
+indent_size = 4
Signature · 5 lines
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

Re: [LTP] [PATCH v1 3/3] editorconfig: add consistent formatting rules for LTP

Hi Jan,

Quoted 2 lines

Introduce .editorconfig to keep indentation and whitespace consistent across editors, preventing accidental reformatting and noisy diffs.

+1, I was thinking about adding it looking on kernel [1] and Buildroot [2] config some time ago.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/.editorconfig
[2] https://github.com/buildroot/buildroot/blob/master/.editorconfig

Generally LGTM.

BTW I would separate this from the actual code change (not relevant).

.editorconfig line 1

Quoted 13 lines
---
 .editorconfig | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 .editorconfig
.editorconfig new file +1 -0
new file mode 100644
index 000000000000..ee9f49516e53
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-only

Any particular reason for GPL v2 only? The default LTP license is GPL-2.0-or-later.

Quoted 4 lines
.editorconfig new file +4 -0
+
+# EditorConfig configuration for LTP
+# https://editorconfig.org/
+

.editorconfig line 15

Quoted 10 lines
.editorconfig new file +10 -0
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+# C/Assembly source files, headers, and Makefiles use tabs
+[*.{c,h,mk,S,sh,awk}]

FYI we have only single awk file which IMHO nobody uses (it may be deleted):
testcases/open_posix_testsuite/scripts/print-pass-fail-summary.awk

.editorconfig line 17

Quoted 2 lines
.editorconfig new file +2 -0
+indent_style = tab
+indent_size = 8

When we use tab anyway (i.e. it's about how is the tab displayed), could it be indent_size = 4 ?

.editorconfig line 19

Quoted 2 lines
.editorconfig new file +2 -0
+
+[{Makefile,Makefile.*}]

nit: we should probably add here *.mk.in

.editorconfig line 26

Quoted 7 lines
.editorconfig new file +7 -0
+indent_style = tab
+indent_size = 8
+
+# Python and Perl scripts use spaces
+[*.{py,pl}]
+indent_style = space
+indent_size = 4

Most of our python based tests contain tabs, see testcases/network/nfsv4/acl/ and testcases/realtime/func/pi-tests/.
OTOH doc/conf.py would have to be converted to tabs.

Also on perl it's hard to even decide, because vendored scripts/checkpatch.pl uses tabs (and we modify it), but vendored scripts/checkbashisms.pl uses spaces.

.editorconfig line 31

Quoted 5 lines
.editorconfig new file +5 -0
+
+# Documentation files
+[*.{rst,md}]
+indent_style = space
+indent_size = 3

If this setup is used for e.g. code block, than I would say we should have indent_size = 4 to match the actual doc (doc/developers/test_case_tutorial.rst).

.editorconfig line 36

Quoted 5 lines
.editorconfig new file +5 -0
+
+# JSON files
+[*.json]
+indent_style = space
+indent_size = 4

I'm ok with it, but our JSON files (tests added by Cyril) might be reformatted.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp