Skip to contentSkip to conversation

libtraceevent: Make sure 32 bit works on 64 bit file systems

PATCH New Steven Rostedt 1 participant 1 message Dec 21, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 libtraceevent: Make sure 32 bit works on 64 bit file systems

From: "Steven Rostedt (Google)" <[email protected]>

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.

---
Changes since v2: https://lore.kernel.org/linux-trace-devel/[email protected]/

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

 Makefile | 3 +++
 1 file changed, 3 insertions(+)
Makefile +3 -0
index 965ff47eae7d..746aedb528de 100644
@@ -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
Signature · 1 line
2.35.1