Skip to content

Commit 2cbad98

Browse files
Paolo Abeniborkmann
Paolo Abeni
authored andcommitted
bpf: Do not WARN in bpf_warn_invalid_xdp_action()
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: Paolo Abeni <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Link: https://lore.kernel.org/bpf/016ceec56e4817ebb2a9e35ce794d5c917df572c.1638189075.git.pabeni@redhat.com
1 parent e94fac3 commit 2cbad98

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/core/filter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8184,9 +8184,9 @@ void bpf_warn_invalid_xdp_action(u32 act)
81848184
{
81858185
const u32 act_max = XDP_REDIRECT;
81868186

8187-
WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n",
8188-
act > act_max ? "Illegal" : "Driver unsupported",
8189-
act);
8187+
pr_warn_once("%s XDP return value %u, expect packet loss!\n",
8188+
act > act_max ? "Illegal" : "Driver unsupported",
8189+
act);
81908190
}
81918191
EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
81928192

0 commit comments

Comments
 (0)