Including alongside 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 from the test sources in favor of (with 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 --- 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 -#include -#include #include #include #include #include #include #include +#include #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 -#include -#include #include #include #include @@ -17,6 +15,7 @@ #include #include #include +#include #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 -#include -#include #include #include #include @@ -29,6 +27,7 @@ #include #include #include +#include #include "../utils.h" #include "empty_mntns.h" -- 2.45.1