From: "Lena Wang (王娜)" <Lena.Wang@mediatek.com>
To: "kuba@kernel.org" <kuba@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Shiming Cheng (成诗明)" <Shiming.Cheng@mediatek.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"edumazet@google.com" <edumazet@google.com>,
"willemdebruijn.kernel@gmail.com"
<willemdebruijn.kernel@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [PATCH net] net: prevent pulling SKB_GSO_FRAGLIST skb
Date: Wed, 15 May 2024 09:02:35 +0000 [thread overview]
Message-ID: <bc69f8cc4aed8b16daba17c0ca0199fe6d7d24a8.camel@mediatek.com> (raw)
In-Reply-To: <20240429064209.5ce59350@kernel.org>
On Mon, 2024-04-29 at 06:42 -0700, Jakub Kicinski wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> On Sun, 28 Apr 2024 22:29:13 +0800 shiming.cheng@mediatek.com wrote:
> > From: Shiming Cheng <shiming.cheng@mediatek.com>
> >
> > BPF or TC callers may pull in a length longer than skb_headlen()
> > for a SKB_GSO_FRAGLIST skb. The data in fraglist will be pulled
> > into the linear space. However it destroys the skb's structure
> > and may result in an invalid segmentation or kernel exception.
> >
> > So we should add protection to stop the operation and return
> > error to remind callers.
>
> One of the fixes you posted breaks the
>
> tools/testing/selftests/net/udpgro_fwd.sh
>
> selftest. Please investigate, and either adjust the test or the fix.
Dear Jakub,
Sorry for late response.
As we do not make selftest before, I try to build a test environmen and
cost time to apply sudo access right in our company server. Now it
blocks to generate xdp_dummy.bpf.o. Could you please give some guidline
about the script test step? Thanks.
Could you give more info about the failed situation?
Is it this fix "[PATCH net] net: prevent pulling SKB_GSO_FRAGLIST skb"
failed?
Which case is failed?
Is it possible that the test case has issue?
> {
> > +if (skb_is_gso(skb) &&
> > + (skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST) &&
> > + write_len > skb_headlen(skb)) {
> > +return -ENOMEM;
> > +}
> > +
>
> Most callers of skb_ensure_writable pull less than headlen.
> It might be good to start with the write_len check. Before
> looking at gso type.
>
Dear Willem,
I will udpate as your advice in v2 as:
+if (write_len > skb_headlen(skb) && skb_is_gso(skb) &&
+ (skb_shinfo
(skb)->gso_type & SKB_GSO_FRAGLIST)) {
About selftests/net/udpgro_fwd.sh case failed, do you know the reason
or have any advice?
Thanks
Lena
next prev parent reply other threads:[~2024-05-15 9:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-28 14:29 [PATCH net] net: prevent pulling SKB_GSO_FRAGLIST skb shiming.cheng
2024-04-29 13:28 ` Willem de Bruijn
2024-04-29 13:42 ` Jakub Kicinski
2024-05-15 9:02 ` Lena Wang (王娜) [this message]
2024-05-16 15:11 ` Jakub Kicinski
2024-05-23 10:03 ` Lena Wang (王娜)
2024-05-23 12:46 ` Willem de Bruijn
2024-05-23 14:59 ` Willem de Bruijn
2024-05-29 11:35 ` Lena Wang (王娜)
2024-05-29 14:04 ` Willem de Bruijn
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=bc69f8cc4aed8b16daba17c0ca0199fe6d7d24a8.camel@mediatek.com \
--to=lena.wang@mediatek.com \
--cc=Shiming.Cheng@mediatek.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@gmail.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;
as well as URLs for NNTP newsgroup(s).