Netdev List
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Bobby Eshleman <bobbyeshleman@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, Mina Almasry <almasrymina@google.com>
Subject: Re: [PATCH net 1/1] net: devmem: prevent net-iov / page mixing
Date: Mon, 27 Jul 2026 11:51:32 +0100	[thread overview]
Message-ID: <954583a4-e3b2-4a01-8ec0-bdb913faee69@gmail.com> (raw)
In-Reply-To: <amO4DN0oAzkt9n18@devvm29614.prn0.facebook.com>

On 7/24/26 20:07, Bobby Eshleman wrote:
> On Wed, Jul 22, 2026 at 07:58:27PM +0100, Pavel Begunkov wrote:
>> On 7/22/26 18:59, Bobby Eshleman wrote:
>>> On Wed, Jul 22, 2026 at 11:58:46AM +0100, Pavel Begunkov wrote:
>>>> We should either have net_iov or page backed frags in a single skb,
>>>> otherwise it blows up down the stack. Don't allow mixing in
>>>> zerocopy_fill_skb_from_devmem().
>>>>
>>>> Fixes: bd61848900bff ("net: devmem: Implement TX path")
>>>> Cc: stable@vger.kernel.org
>>>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>>>> ---
>>>>    net/core/datagram.c | 3 +++
>>>>    1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/net/core/datagram.c b/net/core/datagram.c
>>>> index c285c6465923..35febc1c25fa 100644
>>>> --- a/net/core/datagram.c
>>>> +++ b/net/core/datagram.c
>>>> @@ -712,6 +712,9 @@ zerocopy_fill_skb_from_devmem(struct sk_buff *skb, struct iov_iter *from,
>>>>    	size_t virt_addr, size, off;
>>>>    	struct net_iov *niov;
>>>> +	if (i && skb_frags_readable(skb))
>>>> +		return -EEXIST;
>>>
>>> Are we trying to hit the -EEXIST handler in tcp_sendmsg_locked() so that
>>> we start a new skb? If so, I think we might need to plumb this -EEXIST
>>> case through skb_zerocopy_iter_stream() too?
>>
>> Easier to EFAULT. It'd more consistent, and I don't care how tcp takes
>> it specifically.
>>
>> -- 
>> Pavel Begunkov
>>
> 
> One socket is allowed to queue non-devmem followed by devmem, and EFAULT
> will break this case. I think EEXIST is right, just needs to propagate
> up.
Regardless of whether it's a good thing or not, mixing is already
rejected, see zerocopy_fill_skb_from_iter(). Not 100% consistent
though for the user as it's timing dependent.

-- 
Pavel Begunkov


  reply	other threads:[~2026-07-27 10:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 10:58 [PATCH net 1/1] net: devmem: prevent net-iov / page mixing Pavel Begunkov
2026-07-22 17:59 ` Bobby Eshleman
2026-07-22 18:58   ` Pavel Begunkov
2026-07-24 19:07     ` Bobby Eshleman
2026-07-27 10:51       ` Pavel Begunkov [this message]
2026-07-22 19:49 ` Mina Almasry
2026-07-22 20:20   ` Pavel Begunkov
2026-07-23 17:24   ` Bobby Eshleman
2026-07-23 18:35     ` Mina Almasry
2026-07-23 23:10       ` Bobby Eshleman
2026-07-24 17:26         ` Mina Almasry
2026-07-24 18:52           ` Bobby Eshleman
2026-07-24 17:25       ` Mina Almasry
2026-07-24 17:40         ` Mina Almasry
2026-07-27 11:05         ` Pavel Begunkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=954583a4-e3b2-4a01-8ec0-bdb913faee69@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=almasrymina@google.com \
    --cc=bobbyeshleman@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox