Skip to content

Commit 8fa655a

Browse files
minchankrostedt
authored andcommitted
tracing: Fix alignment of static buffer
With 5.9 kernel on ARM64, I found ftrace_dump output was broken but it had no problem with normal output "cat /sys/kernel/debug/tracing/trace". With investigation, it seems coping the data into temporal buffer seems to break the align binary printf expects if the static buffer is not aligned with 4-byte. IIUC, get_arg in bstr_printf expects that args has already right align to be decoded and seq_buf_bprintf says ``the arguments are saved in a 32bit word array that is defined by the format string constraints``. So if we don't keep the align under copy to temporal buffer, the output will be broken by shifting some bytes. This patch fixes it. Link: https://lkml.kernel.org/r/[email protected] Cc: <[email protected]> Fixes: 8e99cf9 ("tracing: Do not allocate buffer in trace_find_next_entry() in atomic") Signed-off-by: Namhyung Kim <[email protected]> Signed-off-by: Minchan Kim <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 310e3a4 commit 8fa655a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3534,7 +3534,7 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu,
35343534
}
35353535

35363536
#define STATIC_TEMP_BUF_SIZE 128
3537-
static char static_temp_buf[STATIC_TEMP_BUF_SIZE];
3537+
static char static_temp_buf[STATIC_TEMP_BUF_SIZE] __aligned(4);
35383538

35393539
/* Find the next real entry, without updating the iterator itself */
35403540
struct trace_entry *trace_find_next_entry(struct trace_iterator *iter,

0 commit comments

Comments
 (0)