Commit 1fc5c9f6 authored by Alan Maguire's avatar Alan Maguire Committed by Yang Yingliang
Browse files

bpf: Use dedicated bpf_trace_printk event instead of trace_printk()

mainline inclusion
from mainline-v5.9-rc1
commit ac5a72ea
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4PKDW


CVE: NA

--------------------------------

The bpf helper bpf_trace_printk() uses trace_printk() under the hood.
This leads to an alarming warning message originating from trace
buffer allocation which occurs the first time a program using
bpf_trace_printk() is loaded.

We can instead create a trace event for bpf_trace_printk() and enable
it in-kernel when/if we encounter a program using the
bpf_trace_printk() helper.  With this approach, trace_printk()
is not used directly and no warning message appears.

This work was started by Steven (see Link) and finished by Alan; added
Steven's Signed-off-by with his permission.

Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: default avatarAlan Maguire <alan.maguire@oracle.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/r/20200628194334.6238b933@oasis.local.home
Link: https://lore.kernel.org/bpf/1594641154-18897-2-git-send-email-alan.maguire@oracle.com


Signed-off-by: Liu Xinpeng <liuxp11@chinatelecom.cn>	# openEuler_contributor
Signed-off-by: Ctyun Kernel <ctyuncommiter01@chinatelecom.cn>	# openEuler_contributor
Signed-off-by: default avatarPu Lehui <pulehui@huawei.com>
Reviewed-by: default avatarYang Jihong <yangjihong1@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent ea3aea7a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment