Commit c5175a1
bpf: Fix BPF_PROG_QUERY last field check
While working on the ebpf-go [0] library integration for bpf_mprog and tcx,
Lorenz noticed that two subsequent BPF_PROG_QUERY requests currently fail. A
typical workflow is to first gather the bpf_mprog count without passing program/
link arrays, followed by the second request which contains the actual array
pointers.
The initial call populates count and revision fields. The second call gets
rejected due to a BPF_PROG_QUERY_LAST_FIELD bug which should point to
query.revision instead of query.link_attach_flags since the former is really
the last member.
It was not noticed in libbpf as bpf_prog_query_opts() always calls bpf(2) with
an on-stack bpf_attr that is memset() each time (and therefore query.revision
was reset to zero).
[0] https://ebpf-go.dev
Fixes: e420bed ("bpf: Add fd-based tcx multi-prog infra with link support")
Reported-by: Lorenz Bauer <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>1 parent c4d4919 commit c5175a1
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3913 | 3913 | | |
3914 | 3914 | | |
3915 | 3915 | | |
3916 | | - | |
| 3916 | + | |
3917 | 3917 | | |
3918 | 3918 | | |
3919 | 3919 | | |
| |||
0 commit comments