提交 29bcb5ab 编写于 作者: P Paolo Abeni 提交者: Yongqiang Liu

bpf: Do not WARN in bpf_warn_invalid_xdp_action()

stable inclusion
from linux-4.19.226
commit f6d5eb174ee9b9ca4911b98f243f149fbfd19a43

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

[ Upstream commit 2cbad989 ]

The WARN_ONCE() in bpf_warn_invalid_xdp_action() can be triggered by
any bugged program, and even attaching a correct program to a NIC
not supporting the given action.

The resulting splat, beyond polluting the logs, fouls automated tools:
e.g. a syzkaller reproducers using an XDP program returning an
unsupported action will never pass validation.

Replace the WARN_ONCE with a less intrusive pr_warn_once().
Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Acked-by: NToke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/016ceec56e4817ebb2a9e35ce794d5c917df572c.1638189075.git.pabeni@redhat.comSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 df86183c
...@@ -5528,9 +5528,9 @@ void bpf_warn_invalid_xdp_action(u32 act) ...@@ -5528,9 +5528,9 @@ void bpf_warn_invalid_xdp_action(u32 act)
{ {
const u32 act_max = XDP_REDIRECT; const u32 act_max = XDP_REDIRECT;
WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", pr_warn_once("%s XDP return value %u, expect packet loss!\n",
act > act_max ? "Illegal" : "Driver unsupported", act > act_max ? "Illegal" : "Driver unsupported",
act); act);
} }
EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册