]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tracing: Move buffer in trace_seq to end of struct
authorElijah Wright <git@elijahs.space>
Thu, 21 Aug 2025 05:39:07 +0000 (22:39 -0700)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 23 Sep 2025 13:37:31 +0000 (09:37 -0400)
TRACE_SEQ_BUFFER_SIZE is dependent on the architecture for its size. on 64-bit
systems, it is 8148 bytes. forced 8-byte alignment in size_t and seq_buf means
that trace_seq is 8200 bytes on 64-bit systems. moving the buffer to the end
of the struct fixes the issue. there shouldn't be any side effects, i.e.
pointer arithmetic on trace_seq

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250821053917.23301-1-git@elijahs.space
Signed-off-by: Elijah Wright <git@elijahs.space>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
include/linux/trace_seq.h

index a93ed5ac322656bc75ede8292dd4b1e963c18bd1..557780fe1c775a7ebd53331f4cdbe80d3485f863 100644 (file)
        (sizeof(struct seq_buf) + sizeof(size_t) + sizeof(int)))
 
 struct trace_seq {
-       char                    buffer[TRACE_SEQ_BUFFER_SIZE];
        struct seq_buf          seq;
        size_t                  readpos;
        int                     full;
+       char                    buffer[TRACE_SEQ_BUFFER_SIZE];
 };
 
 static inline void