[PATCH] tracing: do not leak kernel addresses

From: Mark Salyzyn
Date: Wed Jul 25 2018 - 16:23:12 EST


From: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>

Switch from 0x%lx to 0x%pK to print the kernel addresses.

Fixes: CVE-2017-0630
Signed-off-by: Mark Salyzyn <salyzyn@xxxxxxxxxxx>
Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: <kernel-team@xxxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # 3.18, 4.4, 4.9, 4.14
Cc: <linux-kernel@xxxxxxxxxxxxxxx>

---
kernel/trace/trace_printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index ad1d6164e946..93698023baf1 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -304,7 +304,7 @@ static int t_show(struct seq_file *m, void *v)
if (!*fmt)
return 0;

- seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt);
+ seq_printf(m, "0x%pK : \"", *(unsigned long *)fmt);

/*
* Tabs and new lines need to be converted.
--
2.18.0.233.g985f88cf7e-goog