[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ZVvRwIUFOAP5lacY@google.com>
Date: Mon, 20 Nov 2023 13:38:08 -0800
From: Stanislav Fomichev <sdf@...gle.com>
To: bpf@...r.kernel.org, netdev@...r.kernel.org
Cc: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
martin.lau@...ux.dev, song@...nel.org, yhs@...com, john.fastabend@...il.com,
kpsingh@...nel.org, haoluo@...gle.com, jolsa@...nel.org,
Dipendra Khadka <kdipendra88@...il.com>,
syzbot+44c2416196b7c607f226@...kaller.appspotmail.com
Subject: Re: [PATCH bpf-next 1/2] netdevsim: don't accept device bound programs
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@...il.com>
> Reported-by: syzbot+44c2416196b7c607f226@...kaller.appspotmail.com
> Fixes: 2b3486bc2d23 ("bpf: Introduce device-bound XDP programs")
> Signed-off-by: Stanislav Fomichev <sdf@...gle.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..
Powered by blists - more mailing lists