All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: syzbot <syzbot+08811615f0e17bc6708b@syzkaller.appspotmail.com>,
	andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
	daniel@iogearbox.net, davem@davemloft.net, eddyz87@gmail.com,
	haoluo@google.com, hawk@kernel.org, john.fastabend@gmail.com,
	jolsa@kernel.org, kpsingh@kernel.org,
	linux-kernel@vger.kernel.org, martin.lau@linux.dev,
	netdev@vger.kernel.org, sdf@fomichev.me, song@kernel.org,
	syzkaller-bugs@googlegroups.com, yonghong.song@linux.dev
Subject: Re: [PATCH net-net] tun: Assign missing bpf_net_context.
Date: Wed, 3 Jul 2024 12:01:43 -0700	[thread overview]
Message-ID: <20240703120143.43cc1770@kernel.org> (raw)
In-Reply-To: <20240703122758.i6lt_jii@linutronix.de>

On Wed, 3 Jul 2024 14:27:58 +0200 Sebastian Andrzej Siewior wrote:
> During the introduction of struct bpf_net_context handling for
> XDP-redirect, the tun driver has been missed.
> 
> Set the bpf_net_context before invoking BPF XDP program within the TUN
> driver.

Sorry if I'm missing the point but I think this is insufficient.
You've covered the NAPI-like entry point to the Rx stack in your
initial work, but there's also netif_receive_skb() which drivers 
may call outside of NAPI, simply disabling BH before the call.

The only concern in that case is that we end up in do_xdp_generic(),
and there's no bpf_net_set_ctx() anywhere on the way. So my intuition
would be to add the bpf_net_set_ctx() inside the if(xdp_prog) in
do_xdp_generic(). "XDP generic" has less stringent (more TC-like) 
perf requirements, so setting context once per packet should be fine.
And it will also cover drivers like TUN which use both
netif_receive_skb() and call do_xdp_generic(), in a single place.

  reply	other threads:[~2024-07-03 19:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 20:19 [syzbot] [net?] [bpf?] general protection fault in dev_map_redirect syzbot
2024-07-02 18:40 ` Jakub Kicinski
2024-07-03 12:27   ` [PATCH net-net] tun: Assign missing bpf_net_context Sebastian Andrzej Siewior
2024-07-03 19:01     ` Jakub Kicinski [this message]
2024-07-03 19:21       ` Sebastian Andrzej Siewior
2024-07-04 10:14         ` [PATCH v2 " Sebastian Andrzej Siewior
2024-07-04 14:24           ` Jakub Kicinski
2024-07-04 14:48             ` [PATCH v3 net-next] " Sebastian Andrzej Siewior
2024-07-06  0:10               ` patchwork-bot+netdevbpf
2024-09-12 12:06       ` [PATCH net-net] " Breno Leitao
2024-09-12 12:28         ` Sebastian Andrzej Siewior
2024-09-12 13:17           ` Breno Leitao
2024-09-12 13:32             ` Vadim Fedorenko
2024-09-12 14:19               ` Breno Leitao
2024-09-12 14:30                 ` Sebastian Andrzej Siewior
2024-09-12 14:40                   ` Breno Leitao
2024-09-12 13:33             ` Sebastian Andrzej Siewior
2024-09-12 15:03             ` Daniel Borkmann
2024-09-16 10:19               ` Sebastian Andrzej Siewior
2024-09-12 14:24           ` Toke Høiland-Jørgensen
2024-07-06  6:21 ` [syzbot] [bpf?] [net?] general protection fault in dev_map_redirect syzbot
2024-07-06 13:13   ` Sebastian Andrzej Siewior
2024-07-06 13:38     ` syzbot

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=20240703120143.43cc1770@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=syzbot+08811615f0e17bc6708b@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=yonghong.song@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.