From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
lazyming <minhnguyen.080505@gmail.com>,
netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, w@1wt.eu,
security@kernel.org, linux-kernel@vger.kernel.org,
lazyming <minhnguyen.080505@gmail.com>,
stable@vger.kernel.org, asml.silence@gmail.com,
achender@kernel.org
Subject: Re: [PATCH net] net: skbuff: fix missing zerocopy reference in pskb_carve helpers
Date: Sun, 24 May 2026 10:06:36 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.27d7990b24613@gmail.com> (raw)
In-Reply-To: <willemdebruijn.kernel.10f46164d2a79@gmail.com>
Willem de Bruijn wrote:
> lazyming wrote:
> > pskb_carve_inside_header() and pskb_carve_inside_nonlinear() both copy
> > the old skb_shared_info header into a new buffer via memcpy(), which
> > includes the destructor_arg pointer (uarg) for MSG_ZEROCOPY skbs.
>
> These functions are not supposed to maintain zerocopy frags.
>
> Both call skb_orphan_frags.
>
> I think what may need to happen is to invert the order of that call
> and the memcpy. Current code:
>
> memcpy((struct skb_shared_info *)(data + size),
> skb_shinfo(skb), offsetof(struct skb_shared_info, frags[0]));
> if (skb_orphan_frags(skb, gfp_mask)) {
> skb_kfree_head(data);
> return -ENOMEM;
> }
Never mind. This actually corresponds to the first Sashiko report you
mentioned: if zerocopy skbs are converted, then the memcpy prior to
that call will have stale state.
For skbs where skb_orphan_frags does not do a deep copy, we do need to
take this extra reference.
Reviewed-by: Willem de Bruijn <willemb@google.com>
prev parent reply other threads:[~2026-05-24 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 12:16 [PATCH net] net: skbuff: fix missing zerocopy reference in pskb_carve helpers lazyming
2026-05-23 8:58 ` lazyming
2026-05-24 13:37 ` Willem de Bruijn
2026-05-24 14:06 ` Willem de Bruijn [this message]
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=willemdebruijn.kernel.27d7990b24613@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=achender@kernel.org \
--cc=asml.silence@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minhnguyen.080505@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=security@kernel.org \
--cc=stable@vger.kernel.org \
--cc=w@1wt.eu \
/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