Skip to content

bpf: Allow XDP_REDIRECT for XDP dev-bound programs #8858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: bpf-next_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: bpf: Allow XDP_REDIRECT for XDP dev-bound programs
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=957769

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 91dbac4
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=957769
version: 3

In the current implementation if the program is dev-bound to a specific
device, it will not be possible to perform XDP_REDIRECT into a DEVMAP
or CPUMAP even if the program is running in the driver NAPI context and
it is not attached to any map entry. This seems in contrast with the
explanation available in bpf_prog_map_compatible routine.
Fix the issue introducing __bpf_prog_map_compatible utility routine in
order to avoid bpf_prog_is_dev_bound() check running bpf_check_tail_call()
at program load time (bpf_prog_select_runtime()).
Continue forbidding to attach a dev-bound program to XDP maps
(BPF_MAP_TYPE_PROG_ARRAY, BPF_MAP_TYPE_DEVMAP and BPF_MAP_TYPE_CPUMAP).

Fixes: 3d76a4d ("bpf: XDP metadata RX kfuncs")
Acked-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 224ee86
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=957769
version: 3

…progs

Improve xdp_metadata bpf selftest in order to check it is possible for a
XDP dev-bound program to perform XDP_REDIRECT into a DEVMAP but it is still
not allowed to attach a XDP dev-bound program to a DEVMAP entry.

Acked-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant