bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: "Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	bpf@vger.kernel.org, "Toke Høiland-Jørgensen" <toke@redhat.com>
Subject: [PATCH v3 net-next 1/2] bpf: do not WARN in bpf_warn_invalid_xdp_action()
Date: Tue, 30 Nov 2021 11:08:06 +0100	[thread overview]
Message-ID: <016ceec56e4817ebb2a9e35ce794d5c917df572c.1638189075.git.pabeni@redhat.com> (raw)
In-Reply-To: <cover.1638189075.git.pabeni@redhat.com>

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().

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/core/filter.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 8271624a19aa..5631acf3f10c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -8185,9 +8185,9 @@ void bpf_warn_invalid_xdp_action(u32 act)
 {
 	const u32 act_max = XDP_REDIRECT;
 
-	WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n",
-		  act > act_max ? "Illegal" : "Driver unsupported",
-		  act);
+	pr_warn_once("%s XDP return value %u, expect packet loss!\n",
+		     act > act_max ? "Illegal" : "Driver unsupported",
+		     act);
 }
 EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
 
-- 
2.33.1


  reply	other threads:[~2021-11-30 10:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 10:08 [PATCH v3 net-next 0/2] bpf: do not WARN in bpf_warn_invalid_xdp_action() Paolo Abeni
2021-11-30 10:08 ` Paolo Abeni [this message]
2021-11-30 10:08 ` [PATCH v3 net-next 2/2] bpf: let bpf_warn_invalid_xdp_action() report more info Paolo Abeni
2021-11-30 11:33   ` Toke Høiland-Jørgensen
2021-12-03 22:04   ` Daniel Borkmann
2021-12-06 10:20     ` Paolo Abeni
2021-12-06 15:04       ` Daniel Borkmann
2021-12-13 21:51         ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=016ceec56e4817ebb2a9e35ce794d5c917df572c.1638189075.git.pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).