mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory
@ 2026-05-21 10:17 Disha Goel
  2026-05-21 10:17 ` [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test Disha Goel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Disha Goel @ 2026-05-21 10:17 UTC (permalink / raw)
  To: shuah
  Cc: brauner, linux-kselftest, linux-kernel, Disha Goel, kernel test robot

The file_stressor test requires a 30-minute timeout (1800 seconds) due to
its 15-minute runtime plus setup/teardown overhead. This is significantly
longer than the default 45-second timeout used by other filesystem tests.

Move file_stressor into its own subdirectory (filesystems/file_stressor/)
with a dedicated settings file to isolate its timeout configuration. This
prevents the long timeout from affecting other fast-running tests in the
filesystems/ directory.

This restructuring follows the pattern used by other selftests with special
requirements and ensures proper timeout handling in CI/CD environments
while maintaining the default 45-second timeout for other filesystem tests.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/all/202605192100.DvRgEGZ3-lkp@intel.com/
Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
---
v1 -> v2
- Add .gitignore file in filesystems/file_stressor/ to ignore compiled binary
- Update filesystems/.gitignore to remove file_stressor entry

Link to v1: https://lore.kernel.org/all/20260519104210.11836-1-disgoel@linux.ibm.com/

 tools/testing/selftests/Makefile                            | 1 +
 tools/testing/selftests/filesystems/.gitignore              | 1 -
 tools/testing/selftests/filesystems/Makefile                | 2 +-
 .../testing/selftests/filesystems/file_stressor/.gitignore  | 2 ++
 tools/testing/selftests/filesystems/file_stressor/Makefile  | 6 ++++++
 .../filesystems/{ => file_stressor}/file_stressor.c         | 0
 tools/testing/selftests/filesystems/file_stressor/settings  | 3 +++
 7 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/filesystems/file_stressor/.gitignore
 create mode 100644 tools/testing/selftests/filesystems/file_stressor/Makefile
 rename tools/testing/selftests/filesystems/{ => file_stressor}/file_stressor.c (100%)
 create mode 100644 tools/testing/selftests/filesystems/file_stressor/settings

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 6e59b8f63e41..d87fafc6aef6 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -34,6 +34,7 @@ TARGETS += filesystems
 TARGETS += filesystems/binderfs
 TARGETS += filesystems/epoll
 TARGETS += filesystems/fat
+TARGETS += filesystems/file_stressor
 TARGETS += filesystems/overlayfs
 TARGETS += filesystems/statmount
 TARGETS += filesystems/mount-notify
diff --git a/tools/testing/selftests/filesystems/.gitignore b/tools/testing/selftests/filesystems/.gitignore
index 64ac0dfa46b7..3c44753914a6 100644
--- a/tools/testing/selftests/filesystems/.gitignore
+++ b/tools/testing/selftests/filesystems/.gitignore
@@ -2,6 +2,5 @@
 dnotify_test
 devpts_pts
 fclog
-file_stressor
 anon_inode_test
 kernfs_test
diff --git a/tools/testing/selftests/filesystems/Makefile b/tools/testing/selftests/filesystems/Makefile
index 85427d7f19b9..7d342755aa3f 100644
--- a/tools/testing/selftests/filesystems/Makefile
+++ b/tools/testing/selftests/filesystems/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 CFLAGS += $(KHDR_INCLUDES)
-TEST_GEN_PROGS := devpts_pts file_stressor anon_inode_test kernfs_test fclog
+TEST_GEN_PROGS := devpts_pts anon_inode_test kernfs_test fclog
 TEST_GEN_PROGS_EXTENDED := dnotify_test
 
 include ../lib.mk
diff --git a/tools/testing/selftests/filesystems/file_stressor/.gitignore b/tools/testing/selftests/filesystems/file_stressor/.gitignore
new file mode 100644
index 000000000000..1eb3f40077d3
--- /dev/null
+++ b/tools/testing/selftests/filesystems/file_stressor/.gitignore
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+file_stressor
diff --git a/tools/testing/selftests/filesystems/file_stressor/Makefile b/tools/testing/selftests/filesystems/file_stressor/Makefile
new file mode 100644
index 000000000000..88c8231ac144
--- /dev/null
+++ b/tools/testing/selftests/filesystems/file_stressor/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+
+CFLAGS += $(KHDR_INCLUDES)
+TEST_GEN_PROGS := file_stressor
+
+include ../../lib.mk
diff --git a/tools/testing/selftests/filesystems/file_stressor.c b/tools/testing/selftests/filesystems/file_stressor/file_stressor.c
similarity index 100%
rename from tools/testing/selftests/filesystems/file_stressor.c
rename to tools/testing/selftests/filesystems/file_stressor/file_stressor.c
diff --git a/tools/testing/selftests/filesystems/file_stressor/settings b/tools/testing/selftests/filesystems/file_stressor/settings
new file mode 100644
index 000000000000..b675ca93f936
--- /dev/null
+++ b/tools/testing/selftests/filesystems/file_stressor/settings
@@ -0,0 +1,3 @@
+# Timeout for file_stressor test
+# The test runs for 900 seconds (15 minutes) plus setup/teardown time
+timeout=1800
-- 
2.45.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test
  2026-05-21 10:17 [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory Disha Goel
@ 2026-05-21 10:17 ` Disha Goel
  2026-06-15  5:19   ` Ojaswin Mujoo
  2026-06-17 11:18   ` Yeswanth Krishna
  2026-06-15  5:12 ` [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory Ojaswin Mujoo
  2026-06-17 11:14 ` Yeswanth Krishna
  2 siblings, 2 replies; 6+ messages in thread
From: Disha Goel @ 2026-05-21 10:17 UTC (permalink / raw)
  To: shuah; +Cc: brauner, linux-kselftest, linux-kernel, Disha Goel

kernfs_test assumes that flistxattr() on /sys/kernel/warn_count always
returns an empty list. However, systems with SELinux enabled may expose
security.selinux xattr via listxattr() during policy load, which makes
the test fail even though kernfs is behaving correctly.

Allow security.selinux xattr in kernfs_listxattr while continuing to
reject other unexpected xattrs. Keep the existing user.foo getxattr
check unchanged.

This avoids false failures on SELinux-enabled systems while preserving
the original purpose of the test.

Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
---
 .../selftests/filesystems/kernfs_test.c       | 27 +++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/filesystems/kernfs_test.c b/tools/testing/selftests/filesystems/kernfs_test.c
index 84c2b910a60d..a5e480d662e0 100644
--- a/tools/testing/selftests/filesystems/kernfs_test.c
+++ b/tools/testing/selftests/filesystems/kernfs_test.c
@@ -4,6 +4,8 @@
 
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/xattr.h>
 
@@ -12,12 +14,33 @@
 
 TEST(kernfs_listxattr)
 {
+	char *buf, *xattr;
+	ssize_t len, ret;
 	int fd;
 
-	/* Read-only file that can never have any extended attributes set. */
+	/* Read-only file that can never have any extended attributes set.
+	 * However, SELinux may set security.selinux xattr on kernfs files
+	 * during policy load, so we explicitly ignore it.
+	 */
 	fd = open("/sys/kernel/warn_count", O_RDONLY | O_CLOEXEC);
 	ASSERT_GE(fd, 0);
-	ASSERT_EQ(flistxattr(fd, NULL, 0), 0);
+
+	len = flistxattr(fd, NULL, 0);
+	ASSERT_GE(len, 0);
+
+	if (len > 0) {
+		buf = malloc(len);
+		ASSERT_NE(buf, NULL);
+
+		ret = flistxattr(fd, buf, len);
+		ASSERT_EQ(ret, len);
+
+		for (xattr = buf; xattr < buf + len; xattr += strlen(xattr) + 1)
+			ASSERT_EQ(strcmp(xattr, "security.selinux"), 0);
+
+		free(buf);
+	}
+
 	EXPECT_EQ(close(fd), 0);
 }
 
-- 
2.45.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory
  2026-05-21 10:17 [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory Disha Goel
  2026-05-21 10:17 ` [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test Disha Goel
@ 2026-06-15  5:12 ` Ojaswin Mujoo
  2026-06-17 11:14 ` Yeswanth Krishna
  2 siblings, 0 replies; 6+ messages in thread
From: Ojaswin Mujoo @ 2026-06-15  5:12 UTC (permalink / raw)
  To: Disha Goel
  Cc: shuah, brauner, linux-kselftest, linux-kernel, kernel test robot

On Thu, May 21, 2026 at 03:47:56PM +0530, Disha Goel wrote:
> The file_stressor test requires a 30-minute timeout (1800 seconds) due to
> its 15-minute runtime plus setup/teardown overhead. This is significantly
> longer than the default 45-second timeout used by other filesystem tests.
> 
> Move file_stressor into its own subdirectory (filesystems/file_stressor/)
> with a dedicated settings file to isolate its timeout configuration. This
> prevents the long timeout from affecting other fast-running tests in the
> filesystems/ directory.
> 
> This restructuring follows the pattern used by other selftests with special
> requirements and ensures proper timeout handling in CI/CD environments
> while maintaining the default 45-second timeout for other filesystem tests.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/all/202605192100.DvRgEGZ3-lkp@intel.com/
> Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
> ---
> v1 -> v2
> - Add .gitignore file in filesystems/file_stressor/ to ignore compiled binary
> - Update filesystems/.gitignore to remove file_stressor entry
> 
> Link to v1: https://lore.kernel.org/all/20260519104210.11836-1-disgoel@linux.ibm.com/
> 
>  tools/testing/selftests/Makefile                            | 1 +
>  tools/testing/selftests/filesystems/.gitignore              | 1 -
>  tools/testing/selftests/filesystems/Makefile                | 2 +-
>  .../testing/selftests/filesystems/file_stressor/.gitignore  | 2 ++
>  tools/testing/selftests/filesystems/file_stressor/Makefile  | 6 ++++++
>  .../filesystems/{ => file_stressor}/file_stressor.c         | 0
>  tools/testing/selftests/filesystems/file_stressor/settings  | 3 +++
>  7 files changed, 13 insertions(+), 2 deletions(-)
>  create mode 100644 tools/testing/selftests/filesystems/file_stressor/.gitignore
>  create mode 100644 tools/testing/selftests/filesystems/file_stressor/Makefile
>  rename tools/testing/selftests/filesystems/{ => file_stressor}/file_stressor.c (100%)
>  create mode 100644 tools/testing/selftests/filesystems/file_stressor/settings
> 
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 6e59b8f63e41..d87fafc6aef6 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -34,6 +34,7 @@ TARGETS += filesystems
>  TARGETS += filesystems/binderfs
>  TARGETS += filesystems/epoll
>  TARGETS += filesystems/fat
> +TARGETS += filesystems/file_stressor
>  TARGETS += filesystems/overlayfs
>  TARGETS += filesystems/statmount
>  TARGETS += filesystems/mount-notify
> diff --git a/tools/testing/selftests/filesystems/.gitignore b/tools/testing/selftests/filesystems/.gitignore
> index 64ac0dfa46b7..3c44753914a6 100644
> --- a/tools/testing/selftests/filesystems/.gitignore
> +++ b/tools/testing/selftests/filesystems/.gitignore
> @@ -2,6 +2,5 @@
>  dnotify_test
>  devpts_pts
>  fclog
> -file_stressor
>  anon_inode_test
>  kernfs_test
> diff --git a/tools/testing/selftests/filesystems/Makefile b/tools/testing/selftests/filesystems/Makefile
> index 85427d7f19b9..7d342755aa3f 100644
> --- a/tools/testing/selftests/filesystems/Makefile
> +++ b/tools/testing/selftests/filesystems/Makefile
> @@ -1,7 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
>  
>  CFLAGS += $(KHDR_INCLUDES)
> -TEST_GEN_PROGS := devpts_pts file_stressor anon_inode_test kernfs_test fclog
> +TEST_GEN_PROGS := devpts_pts anon_inode_test kernfs_test fclog
>  TEST_GEN_PROGS_EXTENDED := dnotify_test
>  
>  include ../lib.mk
> diff --git a/tools/testing/selftests/filesystems/file_stressor/.gitignore b/tools/testing/selftests/filesystems/file_stressor/.gitignore
> new file mode 100644
> index 000000000000..1eb3f40077d3
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/file_stressor/.gitignore
> @@ -0,0 +1,2 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +file_stressor
> diff --git a/tools/testing/selftests/filesystems/file_stressor/Makefile b/tools/testing/selftests/filesystems/file_stressor/Makefile
> new file mode 100644
> index 000000000000..88c8231ac144
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/file_stressor/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +CFLAGS += $(KHDR_INCLUDES)
> +TEST_GEN_PROGS := file_stressor
> +
> +include ../../lib.mk
> diff --git a/tools/testing/selftests/filesystems/file_stressor.c b/tools/testing/selftests/filesystems/file_stressor/file_stressor.c
> similarity index 100%
> rename from tools/testing/selftests/filesystems/file_stressor.c
> rename to tools/testing/selftests/filesystems/file_stressor/file_stressor.c
> diff --git a/tools/testing/selftests/filesystems/file_stressor/settings b/tools/testing/selftests/filesystems/file_stressor/settings
> new file mode 100644
> index 000000000000..b675ca93f936
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/file_stressor/settings
> @@ -0,0 +1,3 @@
> +# Timeout for file_stressor test
> +# The test runs for 900 seconds (15 minutes) plus setup/teardown time
> +timeout=1800
> -- 

Look good to me Disha. I hope you've tested this on the setup where its
failing to confirm we are able to reliably pass with the patch.

Other than that, feel free to add:

Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>

Regards,
Ojaswin

> 2.45.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test
  2026-05-21 10:17 ` [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test Disha Goel
@ 2026-06-15  5:19   ` Ojaswin Mujoo
  2026-06-17 11:18   ` Yeswanth Krishna
  1 sibling, 0 replies; 6+ messages in thread
From: Ojaswin Mujoo @ 2026-06-15  5:19 UTC (permalink / raw)
  To: Disha Goel; +Cc: shuah, brauner, linux-kselftest, linux-kernel

On Thu, May 21, 2026 at 03:47:57PM +0530, Disha Goel wrote:
> kernfs_test assumes that flistxattr() on /sys/kernel/warn_count always
> returns an empty list. However, systems with SELinux enabled may expose
> security.selinux xattr via listxattr() during policy load, which makes
> the test fail even though kernfs is behaving correctly.
> 
> Allow security.selinux xattr in kernfs_listxattr while continuing to
> reject other unexpected xattrs. Keep the existing user.foo getxattr
> check unchanged.
> 
> This avoids false failures on SELinux-enabled systems while preserving
> the original purpose of the test.
> 
> Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
> ---
>  .../selftests/filesystems/kernfs_test.c       | 27 +++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/filesystems/kernfs_test.c b/tools/testing/selftests/filesystems/kernfs_test.c
> index 84c2b910a60d..a5e480d662e0 100644
> --- a/tools/testing/selftests/filesystems/kernfs_test.c
> +++ b/tools/testing/selftests/filesystems/kernfs_test.c
> @@ -4,6 +4,8 @@
>  
>  #include <fcntl.h>
>  #include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
>  #include <sys/stat.h>
>  #include <sys/xattr.h>
>  
> @@ -12,12 +14,33 @@
>  
>  TEST(kernfs_listxattr)
>  {
> +	char *buf, *xattr;
> +	ssize_t len, ret;
>  	int fd;
>  
> -	/* Read-only file that can never have any extended attributes set. */
> +	/* Read-only file that can never have any extended attributes set.
> +	 * However, SELinux may set security.selinux xattr on kernfs files
> +	 * during policy load, so we explicitly ignore it.
> +	 */
>  	fd = open("/sys/kernel/warn_count", O_RDONLY | O_CLOEXEC);
>  	ASSERT_GE(fd, 0);
> -	ASSERT_EQ(flistxattr(fd, NULL, 0), 0);
> +
> +	len = flistxattr(fd, NULL, 0);
> +	ASSERT_GE(len, 0);
> +
> +	if (len > 0) {
> +		buf = malloc(len);
> +		ASSERT_NE(buf, NULL);
> +
> +		ret = flistxattr(fd, buf, len);
> +		ASSERT_EQ(ret, len);
> +
> +		for (xattr = buf; xattr < buf + len; xattr += strlen(xattr) + 1)
> +			ASSERT_EQ(strcmp(xattr, "security.selinux"), 0);

Hi Disha,

Yes we did check that this particular file was showing selinux xattrs,
so I guess the test's assumption is wrong. 

However, looking a bit more closely this test is designed to check that
when no xattrs are set then listxattr() always returns 0 and getxattr()
returns ENODATA. So having SELinux attributes defeats the purpose of the
test.

Maybe a better approach would be to just skip the test if any SELinux
attribute (or any attribute) is present on this file. Idk if with
SELinux its possible to have a file with no attr, if there is then maybe
we should use that file instead.

Regards,
Ojaswin

> +
> +		free(buf);
> +	}
> +
>  	EXPECT_EQ(close(fd), 0);
>  }
>  
> -- 
> 2.45.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory
  2026-05-21 10:17 [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory Disha Goel
  2026-05-21 10:17 ` [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test Disha Goel
  2026-06-15  5:12 ` [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory Ojaswin Mujoo
@ 2026-06-17 11:14 ` Yeswanth Krishna
  2 siblings, 0 replies; 6+ messages in thread
From: Yeswanth Krishna @ 2026-06-17 11:14 UTC (permalink / raw)
  To: Disha Goel, shuah
  Cc: brauner, linux-kselftest, linux-kernel, kernel test robot

On 21/05/26 3:47 pm, Disha Goel wrote:

> The file_stressor test requires a 30-minute timeout (1800 seconds) due to
> its 15-minute runtime plus setup/teardown overhead. This is significantly
> longer than the default 45-second timeout used by other filesystem tests.
>
> Move file_stressor into its own subdirectory (filesystems/file_stressor/)
> with a dedicated settings file to isolate its timeout configuration. This
> prevents the long timeout from affecting other fast-running tests in the
> filesystems/ directory.
>
> This restructuring follows the pattern used by other selftests with special
> requirements and ensures proper timeout handling in CI/CD environments
> while maintaining the default 45-second timeout for other filesystem tests.
>
> Reported-by: kernel test robot<lkp@intel.com>
> Closes:https://lore.kernel.org/all/202605192100.DvRgEGZ3-lkp@intel.com/
> Signed-off-by: Disha Goel<disgoel@linux.ibm.com>

Hi Disha,

I have tested this patch on my ppc64le system and it works as expected.

Test Environment:
- Kernel: Linux (mainline)

Logs
====
Test Results:
The file_stressor test executed successfully in tools/testing/selftests:

# make TARGETS=filesystems/file_stressor/ run_tests
    CC       file_stressor
# timeout set to 1800
# selftests: filesystems/file_stressor: file_stressor
# TAP version 13
# 1..1
# # Starting 1 tests from 1 test cases.
# #  RUN           file_stressor.slab_typesafe_by_rcu ...
# #            OK  file_stressor.slab_typesafe_by_rcu
# ok 1 file_stressor.slab_typesafe_by_rcu
# # PASSED: 1 / 1 tests passed.
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
ok 1 selftests: filesystems/file_stressor: file_stressor

Please add below tag.

Tested-by: Yeswanth Krishna<yeswanth@linux.ibm.com>

Thanks,
Yeswanth Krishna

> ---
> v1 -> v2
> - Add .gitignore file in filesystems/file_stressor/ to ignore compiled binary
> - Update filesystems/.gitignore to remove file_stressor entry
>
> Link to v1:https://lore.kernel.org/all/20260519104210.11836-1-disgoel@linux.ibm.com/
>
>   tools/testing/selftests/Makefile                            | 1 +
>   tools/testing/selftests/filesystems/.gitignore              | 1 -
>   tools/testing/selftests/filesystems/Makefile                | 2 +-
>   .../testing/selftests/filesystems/file_stressor/.gitignore  | 2 ++
>   tools/testing/selftests/filesystems/file_stressor/Makefile  | 6 ++++++
>   .../filesystems/{ => file_stressor}/file_stressor.c         | 0
>   tools/testing/selftests/filesystems/file_stressor/settings  | 3 +++
>   7 files changed, 13 insertions(+), 2 deletions(-)
>   create mode 100644 tools/testing/selftests/filesystems/file_stressor/.gitignore
>   create mode 100644 tools/testing/selftests/filesystems/file_stressor/Makefile
>   rename tools/testing/selftests/filesystems/{ => file_stressor}/file_stressor.c (100%)
>   create mode 100644 tools/testing/selftests/filesystems/file_stressor/settings
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 6e59b8f63e41..d87fafc6aef6 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -34,6 +34,7 @@ TARGETS += filesystems
>   TARGETS += filesystems/binderfs
>   TARGETS += filesystems/epoll
>   TARGETS += filesystems/fat
> +TARGETS += filesystems/file_stressor
>   TARGETS += filesystems/overlayfs
>   TARGETS += filesystems/statmount
>   TARGETS += filesystems/mount-notify
> diff --git a/tools/testing/selftests/filesystems/.gitignore b/tools/testing/selftests/filesystems/.gitignore
> index 64ac0dfa46b7..3c44753914a6 100644
> --- a/tools/testing/selftests/filesystems/.gitignore
> +++ b/tools/testing/selftests/filesystems/.gitignore
> @@ -2,6 +2,5 @@
>   dnotify_test
>   devpts_pts
>   fclog
> -file_stressor
>   anon_inode_test
>   kernfs_test
> diff --git a/tools/testing/selftests/filesystems/Makefile b/tools/testing/selftests/filesystems/Makefile
> index 85427d7f19b9..7d342755aa3f 100644
> --- a/tools/testing/selftests/filesystems/Makefile
> +++ b/tools/testing/selftests/filesystems/Makefile
> @@ -1,7 +1,7 @@
>   # SPDX-License-Identifier: GPL-2.0
>   
>   CFLAGS += $(KHDR_INCLUDES)
> -TEST_GEN_PROGS := devpts_pts file_stressor anon_inode_test kernfs_test fclog
> +TEST_GEN_PROGS := devpts_pts anon_inode_test kernfs_test fclog
>   TEST_GEN_PROGS_EXTENDED := dnotify_test
>   
>   include ../lib.mk
> diff --git a/tools/testing/selftests/filesystems/file_stressor/.gitignore b/tools/testing/selftests/filesystems/file_stressor/.gitignore
> new file mode 100644
> index 000000000000..1eb3f40077d3
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/file_stressor/.gitignore
> @@ -0,0 +1,2 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +file_stressor
> diff --git a/tools/testing/selftests/filesystems/file_stressor/Makefile b/tools/testing/selftests/filesystems/file_stressor/Makefile
> new file mode 100644
> index 000000000000..88c8231ac144
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/file_stressor/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +CFLAGS += $(KHDR_INCLUDES)
> +TEST_GEN_PROGS := file_stressor
> +
> +include ../../lib.mk
> diff --git a/tools/testing/selftests/filesystems/file_stressor.c b/tools/testing/selftests/filesystems/file_stressor/file_stressor.c
> similarity index 100%
> rename from tools/testing/selftests/filesystems/file_stressor.c
> rename to tools/testing/selftests/filesystems/file_stressor/file_stressor.c
> diff --git a/tools/testing/selftests/filesystems/file_stressor/settings b/tools/testing/selftests/filesystems/file_stressor/settings
> new file mode 100644
> index 000000000000..b675ca93f936
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/file_stressor/settings
> @@ -0,0 +1,3 @@
> +# Timeout for file_stressor test
> +# The test runs for 900 seconds (15 minutes) plus setup/teardown time
> +timeout=1800

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test
  2026-05-21 10:17 ` [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test Disha Goel
  2026-06-15  5:19   ` Ojaswin Mujoo
@ 2026-06-17 11:18   ` Yeswanth Krishna
  1 sibling, 0 replies; 6+ messages in thread
From: Yeswanth Krishna @ 2026-06-17 11:18 UTC (permalink / raw)
  To: Disha Goel, shuah; +Cc: brauner, linux-kselftest, linux-kernel

On 21/05/26 3:47 pm, Disha Goel wrote:

> kernfs_test assumes that flistxattr() on /sys/kernel/warn_count always
> returns an empty list. However, systems with SELinux enabled may expose
> security.selinux xattr via listxattr() during policy load, which makes
> the test fail even though kernfs is behaving correctly.
>
> Allow security.selinux xattr in kernfs_listxattr while continuing to
> reject other unexpected xattrs. Keep the existing user.foo getxattr
> check unchanged.
>
> This avoids false failures on SELinux-enabled systems while preserving
> the original purpose of the test.
>
> Signed-off-by: Disha Goel<disgoel@linux.ibm.com>
> ---

Hi Disha,

I have tested this patch on my ppc64le system and it works as expected.

Test Environment:
- Kernel: Linux (mainline)

Logs
====
# make -C tools/testing/selftests/filesystems run_tests
make: Entering directory '/root/linux/tools/testing/selftests/filesystems'
# timeout set to 45
# selftests: filesystems: kernfs_test
# TAP version 13
# 1..2
# # Starting 2 tests from 1 test cases.
# #  RUN           global.kernfs_listxattr ...
# #            OK  global.kernfs_listxattr
# ok 1 global.kernfs_listxattr
# #  RUN           global.kernfs_getxattr ...
# #            OK  global.kernfs_getxattr
# ok 2 global.kernfs_getxattr
# # PASSED: 2 / 2 tests passed.
# # Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0
ok 3 selftests: filesystems: kernfs_test
|All filesystem selftests also passed without issues.|

Please add below tag.

Tested-by: Yeswanth Krishna<yeswanth@linux.ibm.com>

Thanks,
Yeswanth Krishna

>   .../selftests/filesystems/kernfs_test.c       | 27 +++++++++++++++++--
>   1 file changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/filesystems/kernfs_test.c b/tools/testing/selftests/filesystems/kernfs_test.c
> index 84c2b910a60d..a5e480d662e0 100644
> --- a/tools/testing/selftests/filesystems/kernfs_test.c
> +++ b/tools/testing/selftests/filesystems/kernfs_test.c
> @@ -4,6 +4,8 @@
>   
>   #include <fcntl.h>
>   #include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
>   #include <sys/stat.h>
>   #include <sys/xattr.h>
>   
> @@ -12,12 +14,33 @@
>   
>   TEST(kernfs_listxattr)
>   {
> +	char *buf, *xattr;
> +	ssize_t len, ret;
>   	int fd;
>   
> -	/* Read-only file that can never have any extended attributes set. */
> +	/* Read-only file that can never have any extended attributes set.
> +	 * However, SELinux may set security.selinux xattr on kernfs files
> +	 * during policy load, so we explicitly ignore it.
> +	 */
>   	fd = open("/sys/kernel/warn_count", O_RDONLY | O_CLOEXEC);
>   	ASSERT_GE(fd, 0);
> -	ASSERT_EQ(flistxattr(fd, NULL, 0), 0);
> +
> +	len = flistxattr(fd, NULL, 0);
> +	ASSERT_GE(len, 0);
> +
> +	if (len > 0) {
> +		buf = malloc(len);
> +		ASSERT_NE(buf, NULL);
> +
> +		ret = flistxattr(fd, buf, len);
> +		ASSERT_EQ(ret, len);
> +
> +		for (xattr = buf; xattr < buf + len; xattr += strlen(xattr) + 1)
> +			ASSERT_EQ(strcmp(xattr, "security.selinux"), 0);
> +
> +		free(buf);
> +	}
> +
>   	EXPECT_EQ(close(fd), 0);
>   }
>   

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-06-17 11:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-21 10:17 [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory Disha Goel
2026-05-21 10:17 ` [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test Disha Goel
2026-06-15  5:19   ` Ojaswin Mujoo
2026-06-17 11:18   ` Yeswanth Krishna
2026-06-15  5:12 ` [PATCH v2 1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory Ojaswin Mujoo
2026-06-17 11:14 ` Yeswanth Krishna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®