Thread (6 messages) 6 messages, 3 authors, 2022-02-16

Re: WARNING in bpf_warn_invalid_xdp_action

From: Dmitry Vyukov <dvyukov@google.com>
Date: 2020-01-23 06:19:33
Also in: bpf, linux-doc, lkml

On Wed, Jan 22, 2020 at 10:38 PM Eric Dumazet [off-list ref] wrote:
quoted hunk ↗ jump to hunk


On 1/22/20 1:01 PM, syzbot wrote:
quoted
syzbot has bisected this bug to:

commit 58956317c8de52009d1a38a721474c24aef74fe7
Author: David Ahern [off-list ref]
Date:   Fri Dec 7 20:24:57 2018 +0000

    neighbor: Improve garbage collection

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=124a5985e00000
start commit:   d0f41851 net, ip_tunnel: fix namespaces move
git tree:       net
final crash:    https://syzkaller.appspot.com/x/report.txt?x=114a5985e00000
console output: https://syzkaller.appspot.com/x/log.txt?x=164a5985e00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d9290aeb7e6cf1c4
dashboard link: https://syzkaller.appspot.com/bug?extid=8ce4113dadc4789fac74
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11f99369e00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13d85601e00000

Reported-by: syzbot+8ce4113dadc4789fac74@syzkaller.appspotmail.com
Fixes: 58956317c8de ("neighbor: Improve garbage collection")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
bisection looks bogus...

It would be nice to have alternative helpers to conveniently replace some WARN_ON/WARN_ONCE/...
and not having to hand-code stuff like :
diff --git a/net/core/filter.c b/net/core/filter.c
index 538f6a735a19f017df8e10149cb578107ddc8cbb..633988f7c81b3b4f015d827ccb485e8b227ad20b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6913,11 +6913,15 @@ static bool xdp_is_valid_access(int off, int size,

 void bpf_warn_invalid_xdp_action(u32 act)
 {
+       static bool __section(.data.once) warned;
        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);
+       if (!warned) {
+               warned = true;
+               pr_err("%s XDP return value %u, expect packet loss!\n",
+                      act > act_max ? "Illegal" : "Driver unsupported", act);
+               dump_stack();
+       }
 }
 EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
If a single caller of this function would be enough (or maybe grand
caller with a macro), then we could use pr_err_once/ratelimited and
print 1 line with error and caller function.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help