This series fixes the regression where a device-bound SCHED_CLS program
attached through a shared block is rejected even when it is bound to a
netdev that owns the block, and closes the bind/reoffload replay hole a
later-joining device would otherwise exploit.
Patch 1 gives netdevsim's cls_bpf TC block callback the device-match
check nfp already has; the callback is the authoritative per-device
acceptance boundary and the defect there predates the cls_bpf core
change.
Patch 2 makes the core attach-time check derive the target device from
the shared block's member set (block->q is NULL for a shared block) and
require every member to match, mirroring the broadcast fan-out of the
offload path. Patch 1 is a prerequisite of patch 2 on v7.2+ trees:
commit 120977e2c096 ("net/sched: cls_bpf: reject dev-bound programs
bound to a different device") made the replay path unreachable through
shared blocks as a side effect, and patch 2 re-exposes it, so a stable
tree must take both together.
Patch 3 adds shared-block and late-join coverage to bpf_offload.py; it
uses the existing sample_ret0.bpf.o with an explicit `type classifier`
override instead of adding a new sample object.
---
Changelog:
v1 -> v2
- Patch 1 (netdevsim): enforce bpf_offload_dev_match() on the cls_bpf TC
block callback, closing the bind/reoffload replay path (nipa High).
- Patch 2 (cls_bpf): reject an empty shared block; reformat the comment
(gemini + nipa Low).
- Patch 3 (selftests): new shared-block + late-join coverage in
bpf_offload.py.
- Split the v2 draft into three patches; patches 1 and 2 each carry their
own Fixes: and stable metadata (the selftest companion carries neither).
Jamal Hadi Salim (3):
netdevsim: reject cls_bpf programs bound to another device
net/sched: cls_bpf: accept dev-bound programs on shared blocks
selftests: net: exercise dev-bound cls_bpf on shared blocks
drivers/net/netdevsim/bpf.c | 12 ++
net/sched/cls_bpf.c | 28 ++++-
tools/testing/selftests/net/bpf_offload.py | 139 +++++++++++++++++++++
3 files changed, 175 insertions(+), 4 deletions(-)
--
2.43.0