From: Stanislav Fomichev <sdf@google.com>
To: bpf@vger.kernel.org, netdev@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, song@kernel.org, yhs@fb.com,
john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com,
jolsa@kernel.org, Dipendra Khadka <kdipendra88@gmail.com>,
syzbot+44c2416196b7c607f226@syzkaller.appspotmail.com
Subject: Re: [PATCH bpf-next 1/2] netdevsim: don't accept device bound programs
Date: Mon, 20 Nov 2023 13:38:08 -0800 [thread overview]
Message-ID: <ZVvRwIUFOAP5lacY@google.com> (raw)
In-Reply-To: <20231114045453.1816995-2-sdf@google.com>
On 11/13, Stanislav Fomichev wrote:
> Commit 2b3486bc2d23 ("bpf: Introduce device-bound XDP programs")
> introduced device-bound programs by largely reusing existing
> offloading infrastructure. This changed the semantics of
> 'prog->aux->offload' a bit. Now, it's non-null for both
> offloaded and device-bound programs.
>
> Instead of looking at 'prog->aux->offload' let's call
> bpf_prog_is_offloaded which should be true iff the program
> is offloaded and not merely device-bound.
>
> Cc: Dipendra Khadka <kdipendra88@gmail.com>
> Reported-by: syzbot+44c2416196b7c607f226@syzkaller.appspotmail.com
> Fixes: 2b3486bc2d23 ("bpf: Introduce device-bound XDP programs")
> Signed-off-by: Stanislav Fomichev <sdf@google.com>
> ---
> drivers/net/netdevsim/bpf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c
> index f60eb97e3a62..608953d4f98d 100644
> --- a/drivers/net/netdevsim/bpf.c
> +++ b/drivers/net/netdevsim/bpf.c
> @@ -93,7 +93,7 @@ static void nsim_prog_set_loaded(struct bpf_prog *prog, bool loaded)
> {
> struct nsim_bpf_bound_prog *state;
>
> - if (!prog || !prog->aux->offload)
> + if (!prog || !bpf_prog_is_offloaded(prog->aux))
> return;
>
> state = prog->aux->offload->dev_priv;
> @@ -311,7 +311,7 @@ nsim_setup_prog_hw_checks(struct netdevsim *ns, struct netdev_bpf *bpf)
> if (!bpf->prog)
> return 0;
>
> - if (!bpf->prog->aux->offload) {
> + if (!bpf_prog_is_offloaded(bpf->prog->aux)) {
> NSIM_EA(bpf->extack, "xdpoffload of non-bound program");
> return -EINVAL;
> }
> --
> 2.42.0.869.gea05f2083d-goog
>
Forgot to CC netdev of these..
next parent reply other threads:[~2023-11-20 21:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20231114045453.1816995-1-sdf@google.com>
[not found] ` <20231114045453.1816995-2-sdf@google.com>
2023-11-20 21:38 ` Stanislav Fomichev [this message]
[not found] ` <20231114045453.1816995-3-sdf@google.com>
2023-11-20 21:39 ` [PATCH bpf-next 2/2] bpf: bring back removal of dev-bound id from idr Stanislav Fomichev
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=ZVvRwIUFOAP5lacY@google.com \
--to=sdf@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kdipendra88@gmail.com \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=song@kernel.org \
--cc=syzbot+44c2416196b7c607f226@syzkaller.appspotmail.com \
--cc=yhs@fb.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).