Enforce that all fragments in a nonlinear skb come from compatible
memory providers (and for devmem, the exact same binding).
Patch 1 fixes skb->unreadable propagation in skb_split() and skb_shift().
Patch 2 stores mp_priv directly inside struct net_iov.
Patch 3 adds skb_has_net_iovs(), skb_mem_provider_compat(), and
skb_frags_can_coalesce().
Patch 4 enforces provider/binding compatibility across TX, TCP, GRO,
IP defrag, skb_shift(), and skb_try_coalesce().
v1 -> v2:
- Generalize the check across TX, TCP collapse, GRO, IP defrag,
skb_shift(), and skb_try_coalesce() by storing mp_priv directly in
struct net_iov and introducing skb_frags_can_coalesce().
- Fix skb->unreadable propagation in skb_split() and skb_shift().
- Add KUnit coverage for cross-provider and cross-binding rejection.
- v1: https://lore.kernel.org/netdev/20261008034027.1403188-1-almasrymina@google.com/ (local)
Mina Almasry (4):
net: fix skb->unreadable propagation in skb_split() and skb_shift()
netmem: store memory provider private pointer directly in struct
net_iov
net: add skb_frags_can_coalesce() helper
net: prevent mixing frags from different memory providers or bindings
include/linux/skbuff.h | 58 ++++++++++++++++++++++++++++++++++++++++
include/net/netmem.h | 15 +++++++++--
include/net/tcp.h | 5 ++--
io_uring/zcrx.c | 2 +-
net/core/datagram.c | 4 +--
net/core/dev.c | 14 +++-------
net/core/devmem.c | 3 ++-
net/core/devmem.h | 25 +++++++++++++++--
net/core/gro.c | 16 +++++------
net/core/net_test.c | 34 +++++++++++++++++------
net/core/skbuff.c | 34 ++++++++++++-----------
net/ipv4/inet_fragment.c | 3 +++
net/ipv4/tcp.c | 2 +-
net/ipv4/tcp_output.c | 3 +++
14 files changed, 163 insertions(+), 55 deletions(-)
base-commit: 4dd16e31135ea8437a720222df34e8745f385d6d
--
2.56.0.385.gac671c819a-goog