lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251110144232.3765169-3-nogunix@gmail.com>
Date: Mon, 10 Nov 2025 23:42:32 +0900
From: Masaharu Noguchi <nogunix@...il.com>
To: Jeff Layton <jlayton@...nel.org>,
	Chuck Lever <chuck.lever@...cle.com>
Cc: Jesper Juhl <jesperjuhl76@...il.com>,
	David Laight <david.laight.linux@...il.com>,
	Alexander Aring <alex.aring@...il.com>,
	linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Masaharu Noguchi <nogunix@...il.com>
Subject: [PATCH v2 2/2] samples: vfs: avoid libc AT_RENAME_* redefinitions

Users building the sample after including libc headers such as stdio.h
may inherit libc's AT_RENAME_* macros before <linux/fcntl.h> is pulled
in.  When that happens, the sample ends up with conflicting definitions
or the libc values leak into the rest of the build.

Drop any existing AT_RENAME_* macros before including the uapi header so
that the sample always uses the kernel values and does not trip -Werror
redefinition checks.

Signed-off-by: Masaharu Noguchi <nogunix@...il.com>
---
 samples/vfs/test-statx.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/samples/vfs/test-statx.c b/samples/vfs/test-statx.c
index 49c7a46cee07..0123ab4efe0a 100644
--- a/samples/vfs/test-statx.c
+++ b/samples/vfs/test-statx.c
@@ -20,7 +20,16 @@
 #include <sys/syscall.h>
 #include <sys/types.h>
 #include <linux/stat.h>
+
+/* Undefine AT_RENAME_* macros that may have been set by libc headers
+ * (e.g. stdio.h) to avoid redefinition conflicts with uapi fcntl.h.
+ */
+#undef AT_RENAME_NOREPLACE
+#undef AT_RENAME_EXCHANGE
+#undef AT_RENAME_WHITEOUT
+
 #include <linux/fcntl.h>
+
 #define statx foo
 #define statx_timestamp foo_timestamp
 struct statx;
-- 
2.51.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ