From: Richard Gobert <richardbgobert@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: alexander.duyck@gmail.com, davem@davemloft.net,
dsahern@kernel.org, kuba@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
netdev@vger.kernel.org, pabeni@redhat.com, shuah@kernel.org,
willemdebruijn.kernel@gmail.com
Subject: Re: [PATCH net-next v9 2/3] net: gro: move L3 flush checks to tcp_gro_receive and udp_gro_receive_segment
Date: Fri, 10 May 2024 22:20:03 +0200 [thread overview]
Message-ID: <98b7998a-3111-4892-ba1e-d0a026b64b0b@gmail.com> (raw)
In-Reply-To: <CANn89iJ7TPa350Git+r2dp6rvvJ-TUTYj5RiLi7i5TWsBJO1bQ@mail.gmail.com>
Eric Dumazet wrote:
> On Thu, May 9, 2024 at 8:58 PM Richard Gobert <richardbgobert@gmail.com> wrote:
>>
>
>>
>> Interesting, I think that is indeed a bug, that exists also in the current
>> implementation.
>> NAPI_GRO_CB(p)->ip_fixedid (is_atomic before we renamed it in this commit)
>> is cleared as being part of NAPI_GRO_CB(skb)->zeroed in dev_gro_receive.
>
> And the code there seems wrong.
>
> A compiler can absolutely reorder things, I have seen this many times.
>
> I would play safe here, to make sure NAPI_GRO_CB(skb)->is_atomic = 1;
> can not be lost.
>
> diff --git a/net/core/gro.c b/net/core/gro.c
> index c7901253a1a8fc1e9425add77014e15b363a1623..6e4203ea4d54b8955a504e42633f7667740b796e
> 100644
> --- a/net/core/gro.c
> +++ b/net/core/gro.c
> @@ -470,6 +470,7 @@ static enum gro_result dev_gro_receive(struct
> napi_struct *napi, struct sk_buff
> BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct napi_gro_cb, zeroed),
> sizeof(u32))); /* Avoid slow
> unaligned acc */
> *(u32 *)&NAPI_GRO_CB(skb)->zeroed = 0;
> + barrier();
> NAPI_GRO_CB(skb)->flush = skb_has_frag_list(skb);
> NAPI_GRO_CB(skb)->is_atomic = 1;
> NAPI_GRO_CB(skb)->count = 1;
I removed NAPI_GRO_CB(skb)->is_atomic = 1 from dev_gro_receive in this series
since it is not needed anymore, so going forward this issue is fixed.
I understand your concern about previous versions, I could send a patch to
net to settle this issue.
WDYT?
next prev parent reply other threads:[~2024-05-10 20:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 16:23 [PATCH net-next v9 0/3] net: gro: remove network_header use, move p->{flush/flush_id} calculations to L4 Richard Gobert
2024-05-07 16:28 ` [PATCH net-next v9 1/3] net: gro: use cb instead of skb->network_header Richard Gobert
2024-05-07 16:30 ` [PATCH net-next v9 2/3] net: gro: move L3 flush checks to tcp_gro_receive and udp_gro_receive_segment Richard Gobert
2024-05-07 18:08 ` Eric Dumazet
2024-05-09 18:58 ` Richard Gobert
2024-05-10 7:01 ` Eric Dumazet
2024-05-10 20:20 ` Richard Gobert [this message]
2024-05-09 14:24 ` Willem de Bruijn
2024-05-09 19:02 ` Richard Gobert
2024-05-07 16:31 ` [PATCH net-next v9 3/3] selftests/net: add flush id selftests Richard Gobert
2024-05-08 0:34 ` [PATCH net-next v9 0/3] net: gro: remove network_header use, move p->{flush/flush_id} calculations to L4 Jakub Kicinski
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=98b7998a-3111-4892-ba1e-d0a026b64b0b@gmail.com \
--to=richardbgobert@gmail.com \
--cc=alexander.duyck@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--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 read-only IMAP folder(s) and NNTP newsgroup(s).