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.
Fix the issue introducing __bpf_prog_map_compatible utility routine in
order to avoid bpf_prog_is_dev_bound() during the XDP program load.
Continue forbidding to attach a dev-bound program to XDP maps.

---
Changes in v3:
- move seltest changes in a dedicated patch
- Link to v2: 
https://lore.kernel.org/r/[email protected]

Changes in v2:
- Introduce __bpf_prog_map_compatible() utility routine in order to skip
  bpf_prog_is_dev_bound check in bpf_check_tail_call()
- Extend xdp_metadata selftest
- Link to v1: 
https://lore.kernel.org/r/[email protected]

---
Lorenzo Bianconi (2):
      bpf: Allow XDP dev-bound programs to perform XDP_REDIRECT into maps
      selftests/bpf: xdp_metadata: check XDP_REDIRCT support for dev-bound progs

 kernel/bpf/core.c                                  | 27 +++++++++++++---------
 .../selftests/bpf/prog_tests/xdp_metadata.c        | 22 +++++++++++++++++-
 tools/testing/selftests/bpf/progs/xdp_metadata.c   | 13 +++++++++++
 3 files changed, 50 insertions(+), 12 deletions(-)
---
base-commit: 91dbac4076537b464639953c055c460d2bdfc7ea
change-id: 20250422-xdp-prog-bound-fix-9f30f3e134aa

Best regards,
-- 
Lorenzo Bianconi <[email protected]>


Reply via email to