bpf: fix check of allowed specifiers in bpf_trace_printk
authorMartynas Pumputis <m@lambda.lt>
Fri, 23 Nov 2018 16:43:26 +0000 (17:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Dec 2018 08:28:50 +0000 (09:28 +0100)
commit9209043b29881a7ede5e34610c4feadd29e59e40
treed95085f43fa6f6035a7dd9a3dd27743e460b5d6f
parent42cb0b9efc9e18e8b81e9a296082381fc8b70071
bpf: fix check of allowed specifiers in bpf_trace_printk

[ Upstream commit 1efb6ee3edea57f57f9fb05dba8dcb3f7333f61f ]

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.

Fixes: 9c959c863f82 ("tracing: Allow BPF programs to call bpf_trace_printk()")
Reported-by: syzbot+1ec5c5ec949c4adaa0c4@syzkaller.appspotmail.com
Signed-off-by: Martynas Pumputis <m@lambda.lt>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/bpf_trace.c