* [PATCH 1/2] selftests/empty_mntns: fix header conflicts and remove TOOLS_INCLUDES
@ 2026-10-01 6:57 Disha Goel
2026-10-01 6:57 ` [PATCH 2/2] selftests/empty_mntns: use unused bit in unknown_flags_rejected test Disha Goel
0 siblings, 1 reply; 2+ messages in thread
From: Disha Goel @ 2026-10-01 6:57 UTC (permalink / raw)
To: brauner, shuah; +Cc: linux-fsdevel, linux-kselftest, linux-kernel, Disha Goel
Including <linux/mount.h> alongside <sys/mount.h> in empty_mntns test
files leads to compilation errors with glibc due to conflicting enum
definitions of MS_RDONLY and other mount flags.
Additionally, passing $(TOOLS_INCLUDES) (-isystem tools/include/uapi)
causes tools/include/uapi/linux/types.h to be included, forcing
int-ll64.h definitions on architectures like PowerPC (ppc64le) that
use int-l64.h, resulting in type collisions with system headers.
Fix this by:
- Dropping <linux/mount.h> from the test sources in favor of
<sys/mount.h> (with <linux/stat.h> included after system headers).
- Removing $(TOOLS_INCLUDES) from the Makefile since standard UAPI
headers are already supplied via $(KHDR_INCLUDES).
Fixes: 32f54f2bbccf ("selftests/filesystems: add tests for empty mount namespaces")
Fixes: 5b8ffd63fbd9 ("selftests/filesystems: add clone3 tests for empty mount namespaces")
Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
---
tools/testing/selftests/filesystems/empty_mntns/Makefile | 2 +-
.../filesystems/empty_mntns/clone3_empty_mntns_test.c | 3 +--
.../selftests/filesystems/empty_mntns/empty_mntns_test.c | 3 +--
.../selftests/filesystems/empty_mntns/overmount_chroot_test.c | 3 +--
4 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/filesystems/empty_mntns/Makefile b/tools/testing/selftests/filesystems/empty_mntns/Makefile
index 22e3fb915e81..8d2cb46668fc 100644
--- a/tools/testing/selftests/filesystems/empty_mntns/Makefile
+++ b/tools/testing/selftests/filesystems/empty_mntns/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
-CFLAGS += -Wall -O2 -g $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
+CFLAGS += -Wall -O2 -g $(KHDR_INCLUDES)
LDLIBS += -lcap
TEST_GEN_PROGS := empty_mntns_test overmount_chroot_test clone3_empty_mntns_test
diff --git a/tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c b/tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c
index 6370086f886d..de0cbd1a5ee0 100644
--- a/tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c
+++ b/tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c
@@ -15,14 +15,13 @@
#define _GNU_SOURCE
#include <fcntl.h>
-#include <linux/mount.h>
-#include <linux/stat.h>
#include <stdio.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <linux/stat.h>
#include "../utils.h"
#include "../wrappers.h"
diff --git a/tools/testing/selftests/filesystems/empty_mntns/empty_mntns_test.c b/tools/testing/selftests/filesystems/empty_mntns/empty_mntns_test.c
index 43e296b97d84..a6a90d0b6ff9 100644
--- a/tools/testing/selftests/filesystems/empty_mntns/empty_mntns_test.c
+++ b/tools/testing/selftests/filesystems/empty_mntns/empty_mntns_test.c
@@ -7,8 +7,6 @@
#define _GNU_SOURCE
#include <fcntl.h>
-#include <linux/mount.h>
-#include <linux/stat.h>
#include <sched.h>
#include <stdio.h>
#include <string.h>
@@ -17,6 +15,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <linux/stat.h>
#include "../utils.h"
#include "../wrappers.h"
diff --git a/tools/testing/selftests/filesystems/empty_mntns/overmount_chroot_test.c b/tools/testing/selftests/filesystems/empty_mntns/overmount_chroot_test.c
index 6e21c58258c3..574c03311245 100644
--- a/tools/testing/selftests/filesystems/empty_mntns/overmount_chroot_test.c
+++ b/tools/testing/selftests/filesystems/empty_mntns/overmount_chroot_test.c
@@ -18,8 +18,6 @@
#define _GNU_SOURCE
#include <fcntl.h>
-#include <linux/mount.h>
-#include <linux/stat.h>
#include <sched.h>
#include <stdio.h>
#include <string.h>
@@ -29,6 +27,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <linux/stat.h>
#include "../utils.h"
#include "empty_mntns.h"
--
2.45.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH 2/2] selftests/empty_mntns: use unused bit in unknown_flags_rejected test
2026-10-01 6:57 [PATCH 1/2] selftests/empty_mntns: fix header conflicts and remove TOOLS_INCLUDES Disha Goel
@ 2026-10-01 6:57 ` Disha Goel
0 siblings, 0 replies; 2+ messages in thread
From: Disha Goel @ 2026-10-01 6:57 UTC (permalink / raw)
To: brauner, shuah; +Cc: linux-fsdevel, linux-kselftest, linux-kernel, Disha Goel
The unknown_flags_rejected test uses 0x800000000ULL (1ULL << 35) to test
that clone3() rejects unknown 64-bit flags with -EINVAL.
However, bit 35 has been allocated to CLONE_NNP, causing clone3() to
succeed and the assertion expecting failure to fail.
Switch to (1ULL << 63) which is an unused high bit so the test
consistently expects -EINVAL.
Fixes: 5b8ffd63fbd9 ("selftests/filesystems: add clone3 tests for empty mount namespaces")
Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
---
.../selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c b/tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c
index de0cbd1a5ee0..b271fed3ae70 100644
--- a/tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c
+++ b/tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c
@@ -868,7 +868,7 @@ TEST(unknown_flags_rejected)
if (pid == 0) {
struct __clone_args args = {
- .flags = 0x800000000ULL,
+ .flags = (1ULL << 63),
.exit_signal = SIGCHLD,
};
pid_t ret;
--
2.45.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-01 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 6:57 [PATCH 1/2] selftests/empty_mntns: fix header conflicts and remove TOOLS_INCLUDES Disha Goel
2026-10-01 6:57 ` [PATCH 2/2] selftests/empty_mntns: use unused bit in unknown_flags_rejected test Disha Goel
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®