diff mbox series

[v3] libtraceevent: Make sure 32 bit works on 64 bit file systems

Message ID 20221221134656.79589e83@gandalf.local.home (mailing list archive)
State Accepted
Commit 169a55a0e8e8aacf4f9998ae00d749e447ac3f51
Headers show
Series [v3] libtraceevent: Make sure 32 bit works on 64 bit file systems | expand

Commit Message

Steven Rostedt Dec. 21, 2022, 6:46 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

As stat() can overflow if a 32 bit user space reads a file on a file
system that has inodes greater than MAX_INT. Compile with
_FILE_OFFSET_BITS=64 that mitigates this problem on 32 bit user space.

Reported-by: Mike Frysinger <vapier@google.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Changes since v2: https://lore.kernel.org/linux-trace-devel/20221221134051.53aad658@gandalf.local.home/

 - Add "override" otherwise it can get lost if CFLAGS is defined externally

 Makefile | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 965ff47eae7d..746aedb528de 100644
--- a/Makefile
+++ b/Makefile
@@ -164,6 +164,9 @@  override CFLAGS += -fPIC
 override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
 override CFLAGS += $(udis86-flags) -D_GNU_SOURCE
 
+# Make sure 32 bit stat() works on large file systems
+override CFLAGS += -D_FILE_OFFSET_BITS=64
+
 ifeq ($(VERBOSE),1)
   Q =
 else