I’ve loaded a simple pass program on my XDP interface: ``` bpftool prog list 137: xdp name xdp_prog_simple tag db89f03479f5c101 gpl loaded_at 2019-11-28T16:17:31+0000 uid 0 xlated 208B jited 143B memlock 4096B btf_id 108 ``` The trace I would like to attach is the following: ``` #define bpf_debug(fmt, ...) \ { \ char __fmt[] = fmt; \ bpf_trace_printk(__fmt, sizeof(__fmt), \ ##__VA_ARGS__); \ } BPF_TRACE_2("fexit/xdp_prog_simple", trace_on_exit, struct xdp_md *, ctx, int, ret) { bpf_debug("Debug: %d [ifindex = %u, queue = %u, ret = %d]\n", ctx->ingress_ifindex, ctx->rx_queue_index, ret); return 0; } char _license[] SEC("license") = "GPL"; ```Now I have a simple program trying to open the object file (modeled after fexit_bpf2bpf.c):
```prog_fe = bpf_prog_get_fd_by_id(137); //HERE YOU GET THE ID FROM bpftool list
if (prog_fd < 0) {printf("ERROR: Cant cat program fd, make sure hardcoded ID is ok, and ran as root!\n");
return 0; }DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts, .attach_prog_fd = prog_fd, );
obj = bpf_object__open_file("./xdp_sample_fentry_fexit_kern.o", &opts);
if (IS_ERR_OR_NULL(obj)) { perror("ERROR: Failed to open trace object file"); return 0; } err = bpf_object__load(obj); if (err < 0) { perror("ERROR: Failed to load object file"); return 0; } ``` The load fails: ``` libbpf: load bpf program failed: Argument list too long libbpf: failed to load program 'fexit/xdp_prog_simple' libbpf: failed to load object './xdp_sample_fentry_fexit_kern.o' ERROR: Failed to load object file: Operation not permitted ```I tried using more or fewer arguments to the “fexit/xdp_prog_simple”, but the same problem. If I change the name to something like “fexit/foo” it complains it can not find foo in the program I try to attach too.
Any idea? this is with the latests bpd-next kernel… Cheers, Eelco