On Apr 23, Martin KaFai Lau wrote: > On 4/23/25 10:44 AM, Lorenzo Bianconi wrote: > > 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: 3d76a4d3d4e59 ("bpf: XDP metadata RX kfuncs") > > Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx> > > --- > > 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/20250422-xdp-prog-bound-fix-v1-1-0b581fa186fe@xxxxxxxxxx > > --- > > kernel/bpf/core.c | 27 +++++++++++++--------- > > .../selftests/bpf/prog_tests/xdp_metadata.c | 22 +++++++++++++++++- > > tools/testing/selftests/bpf/progs/xdp_metadata.c | 13 +++++++++++ > > The change lgtm. Please separate the selftest changes to patch 2. Thanks. ack, I will do in v3. Regards, Lorenzo > > pw-bot: cr >
Attachment:
signature.asc
Description: PGP signature