Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] net: missing struct bpf_verifier_log forward declaration in netdevice.h
--

commit 6d93234cac5f9d8bd1858f0479e625aeca6428c5
Author: Leon Hwang <[email protected]>

bpf: Add syscall common attrs support for xdp link_create

This commit adds syscall common attributes support to bpf_xdp_link_attach() so
that invalid target_ifindex errors and underlying driver extack error messages
can be reported through bpf_log(). It also defines a no-op stub for bpf_log()
when CONFIG_BPF_SYSCALL is disabled.

> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 3cff2174dc03a..4548b0fd824db 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -4417,7 +4417,8 @@ struct sk_buff *validate_xmit_skb_list(struct sk_buff 
> *skb, struct net_device *d
>  struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device 
> *dev,
>                                   struct netdev_queue *txq, int *ret);
>  
> -int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
> +int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog,
> +                     struct bpf_verifier_log *log);

[Severity: Low]
Does include/linux/netdevice.h need a forward declaration for
struct bpf_verifier_log alongside struct bpf_prog?

Without a file-scope forward declaration in include/linux/netdevice.h, any
translation unit that includes <linux/netdevice.h> before <linux/bpf.h>,
<linux/btf.h>, or <linux/bpf_verifier.h> declares struct bpf_verifier_log for
the first time inside the parameter list of bpf_xdp_link_attach(), triggering
-Wvisibility warnings.

In net/core/dev.c, <linux/netdevice.h> is included before <linux/bpf.h> and
<linux/bpf_verifier.h>:

    #include <linux/netdevice.h>
    ...
    #include <linux/bpf.h>
    #include <linux/bpf_trace.h>
    #include <linux/bpf_verifier.h>

This causes the prototype in include/linux/netdevice.h to use a
parameter-scoped struct bpf_verifier_log while the definition of
bpf_xdp_link_attach() in net/core/dev.c uses the file-scoped
struct bpf_verifier_log from <linux/bpf_verifier.h>, resulting in a
conflicting types compilation error.

[ ... ]

> diff --git a/net/core/dev.c b/net/core/dev.c
> index 18dc88990510a..96be63b9331e8 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -97,6 +97,7 @@
>  #include <linux/kthread.h>
>  #include <linux/bpf.h>
>  #include <linux/bpf_trace.h>
> +#include <linux/bpf_verifier.h>
>  #include <net/net_namespace.h>
>  #include <net/sock.h>
>  #include <net/busy_poll.h>
> @@ -10771,7 +10772,8 @@ static const struct bpf_link_ops bpf_xdp_link_lops = {
>       .update_prog = bpf_xdp_link_update,
>  };
>  
> -int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
> +int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog,
> +                     struct bpf_verifier_log *log)
>  {

[ ... ]

>       return fd;

[ ... ]

>  }

[ ... ]

>

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to