aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorJoe Maples <joe@frap129.org>2017-05-01 19:45:34 -0500
committerMoyster <oysterized@gmail.com>2017-05-20 19:48:46 +0200
commit69de2265845f7c51e7c33d1415897f99f57aa77c (patch)
tree40816654ed1545c66a1133bd71ea1bc3149b036a /kernel
parent2e3eef83c62657e5b1c32861a774e1a1cc122b14 (diff)
UPSTREAM: tracing: Fix trace_printk() to print when not using bprintk()
The trace_printk() code will allocate extra buffers if the compile detects that a trace_printk() is used. To do this, the format of the trace_printk() is saved to the __trace_printk_fmt section, and if that section is bigger than zero, the buffers are allocated (along with a message that this has happened). If trace_printk() uses a format that is not a constant, and thus something not guaranteed to be around when the print happens, the compiler optimizes the fmt out, as it is not used, and the __trace_printk_fmt section is not filled. This means the kernel will not allocate the special buffers needed for the trace_printk() and the trace_printk() will not write anything to the tracing buffer. Adding a "__used" to the variable in the __trace_printk_fmt section will keep it around, even though it is set to NULL. This will keep the string from being printed in the debugfs/tracing/printk_formats section as it is not needed. Reported-by: Vlastimil Babka <vbabka@suse.cz> Fixes: 07d777fe8c398 "tracing: Add percpu buffers for trace_printk()" Cc: stable@vger.kernel.org # v3.5+ Bug: 34277115 Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Change-Id: I10ce56caa41c7644d9d290d9ed272a6d156c938c Signed-off-by: Joe Maples <joe@frap129.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_printk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 08de52c09..9008103db 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -299,7 +299,7 @@ static int t_show(struct seq_file *m, void *v)
if (!*fmt)
return 0;
- seq_printf(m, "0x%lx : \"", 0L);
+ seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt);
/*
* Tabs and new lines need to be converted.