On Tue, 20 Oct 2026 23:28:00 +0800 Leon Hwang wrote:
> --- 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)
> {
> struct net *net = current->nsproxy->net_ns;
> struct bpf_link_primer link_primer;
> @@ -10784,6 +10786,7 @@ int bpf_xdp_link_attach(const union bpf_attr *attr,
> struct bpf_prog *prog)
> dev = dev_get_by_index(net, attr->link_create.target_ifindex);
> if (!dev) {
> rtnl_unlock();
> + bpf_log(log, "Invalid target_ifindex.\n");
> return -EINVAL;
> }
>
> @@ -10812,6 +10815,8 @@ int bpf_xdp_link_attach(const union bpf_attr *attr,
> struct bpf_prog *prog)
> if (err) {
> link->dev = NULL;
> bpf_link_cleanup(&link_primer);
> + if (extack._msg)
> + bpf_log(log, "%s\n", extack._msg);
> trace_bpf_xdp_link_attach_failed(extack._msg);
> goto out_put_dev;
> }
No, this is silly. We shouldn't be spreading bpf_verifier.h includes
around, and making core networking code use bpf_log().
Add an extack to this API and for the extack -> bpf_log() conversion
in the caller or some "boundary crossing" helper.