mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Disha Goel <disgoel@linux.ibm.com>
To: brauner@kernel.org, shuah@kernel.org
Cc: linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, Disha Goel <disgoel@linux.ibm.com>
Subject: [PATCH 1/2] selftests/empty_mntns: fix header conflicts and remove TOOLS_INCLUDES
Date: Thu,  1 Oct 2026 12:27:27 +0530	[thread overview]
Message-ID: <20261001065728.90239-1-disgoel@linux.ibm.com> (raw)

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


             reply	other threads:[~2026-10-01  6:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  6:57 Disha Goel [this message]
2026-10-01  6:57 ` [PATCH 2/2] selftests/empty_mntns: use unused bit in unknown_flags_rejected test Disha Goel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261001065728.90239-1-disgoel@linux.ibm.com \
    --to=disgoel@linux.ibm.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®