Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpf: Refuse unused attributes in bpf_prog_{attach,detach}
The recently added tcx attachment extended the BPF UAPI for attaching and detaching by a couple of fields. Those fields are currently only supported for tcx, other types like cgroups and flow dissector silently ignore the new fields except for the new flags. This is problematic once we extend bpf_mprog to older attachment types, since it's hard to figure out whether the syscall really was successful if the kernel silently ignores non-zero values. Explicitly reject non-zero fields relevant to bpf_mprog for attachment types which don't use the latter yet. Independent of this, we were also thinking about rejecting attr->replace_bpf_fd for the bpf_prog_detach() case given this is not used there generally. However, this field has been ignored in detach for several releases, thus rejecting has a risk of potential breakage. Fixes: e420bed ("bpf: Add fd-based tcx multi-prog infra with link support") Signed-off-by: Lorenz Bauer <[email protected]> Co-developed-by: Daniel Borkmann <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
- Loading branch information