diff mbox series

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

Message ID 20221221134903.4520c983@gandalf.local.home (mailing list archive)
State Accepted
Commit 6476bc3b39f3e4dad6d2d9baa0e7a491fa08d8fc
Headers show
Series libtracefs: Make sure 32 bit works on 64 bit file systems | expand

Commit Message

Steven Rostedt Dec. 21, 2022, 6:49 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>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ross Zwisler Dec. 22, 2022, 5:35 p.m. UTC | #1
On Wed, Dec 21, 2022 at 01:49:03PM -0500, Steven Rostedt wrote:
> 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>

Tested-by: Ross Zwisler <zwisler@google.com>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 27d425c975ad..36c2076cf788 100644
--- a/Makefile
+++ b/Makefile
@@ -164,6 +164,9 @@  export INCLUDES
 # Append required CFLAGS
 override CFLAGS += -D_GNU_SOURCE $(LIBTRACEEVENT_INCLUDES) $(INCLUDES)
 
+# Make sure 32 bit stat() works on large file systems
+override CFLAGS += -D_FILE_OFFSET_BITS=64
+
 all: all_cmd
 
 LIB_TARGET  = libtracefs.a libtracefs.so.$(TRACEFS_VERSION)