Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Stanislav Fomichev
Mon, 23 Nov 2026 17:29
Re: [PATCH net-next v6 2/7] net: devmem: prevent mixing TX bindings and reject non-devmem xmit
Author: Stanislav Fomichev
Date: Mon, 23 Nov 2026 17:29
Date: Mon, 23 Nov 2026 17:29
39 lines
13202 bytes
13202 bytes
On 11/20, Mina Almasry wrote:
> Two devmem TX paths do not validate the fragment memory provider or
> binding strictly enough:
>
> - When sending with MSG_ZEROCOPY and SCM_DEVMEM_DMABUF across multiple
> devmem TX bindings on the same TCP socket, tcp_sendmsg_locked() and
> zerocopy_fill_skb_from_devmem() only check skb_frags_readable(skb),
> allowing fragments from two different devmem TX bindings to be
> appended into the same skb.
> - validate_xmit_unreadable_skb() checks the binding direction and
> target device only when net_is_devmem_iov(niov) is true, allowing
> unreadable skbs backed by non-devmem net_iov providers (such as
> forwarded io_uring zcrx RX skbs) to bypass validation on
> NETMEM_TX_DMA devices. Using netmem_to_net_iov() also assumes
> frags[0] is a net_iov without checking first.
>
> Add net_devmem_skb_binding() to return the devmem binding of an skb's
> first fragment (all fragments in an skb share the same memory source).
> In tcp_sendmsg_locked(), check net_devmem_skb_binding(skb) != binding
> only when a devmem binding is active so normal non-devmem TX keeps a
> single unlikely(!skb_frags_readable(skb)) check with no extra taken
> branch. In zerocopy_fill_skb_from_devmem(), check
> net_devmem_skb_binding(skb) != binding and return -EMSGSIZE instead of
> -EFAULT so tcp_sendmsg_locked() starts a new segment instead of
> aborting the send with an error. In validate_xmit_unreadable_skb(), use
> skb_frag_net_iov() and drop unreadable skbs on NETMEM_TX_DMA devices
> unless frags[0] is a DMA_TO_DEVICE devmem net_iov bound to dev.
>
> This issue is theoretical and was found by manual code inspection and
> LLM review; it was not triggered in production. Compile-tested and
> boot-tested with the net_core KUnit test suite; not tested on real
> hardware.
>
> Fixes: bd61848900bf ("net: devmem: Implement TX path")
> Fixes: ae28cb114727 ("net: check for driver support in netmem TX")
> Signed-off-by: Mina Almasry <almasrymina@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads