[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181122160030.15954-1-m@lambda.lt>
Date: Thu, 22 Nov 2018 17:00:30 +0100
From: Martynas Pumputis <m@...bda.lt>
To: netdev@...r.kernel.org
Cc: ast@...nel.org, daniel@...earbox.net, m@...bda.lt
Subject: [PATCH] bpf: fix check of allowed specifiers in bpf_trace_printk
A format string consisting of "%p" or "%s" followed by an invalid
specifier (e.g. "%p%\n" or "%s%") could pass the check which
would make format_decode (lib/vsprintf.c) to warn.
Reported-by: syzbot+1ec5c5ec949c4adaa0c4@...kaller.appspotmail.com
Signed-off-by: Martynas Pumputis <m@...bda.lt>
---
kernel/trace/bpf_trace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 08fcfe440c63..9ab05736e1a1 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -225,6 +225,8 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1,
(void *) (long) unsafe_addr,
sizeof(buf));
}
+ if (fmt[i] == '%')
+ i--;
continue;
}
--
2.19.1
Powered by blists - more mailing lists