From: Eric Dumazet <eric.dumazet@gmail.com>
To: Qian Cai <cai@lca.pw>, Eric Dumazet <eric.dumazet@gmail.com>
Cc: davem@davemloft.net, kuba@kernel.org, elver@google.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] skbuff: fix a data race in skb_queue_len()
Date: Mon, 3 Feb 2020 12:28:52 -0800 [thread overview]
Message-ID: <126aa227-2383-efdd-742c-6ccf85ae7ba4@gmail.com> (raw)
In-Reply-To: <D743FB35-3736-45E9-9DE1-8E81929D67C1@lca.pw>
On 2/3/20 12:19 PM, Qian Cai wrote:
>
>
>> On Feb 3, 2020, at 2:42 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>>
>> We do not want to add READ_ONCE() for all uses of skb_queue_len()
>>
>> This could hide some real bugs, and could generate slightly less
>> efficient code in the cases we have the lock held.
>
> Good point. I should have thought about that. How about introducing 2 new helpers.
>
> skb_queue_len_once()
> unix_recvq_full_once()
>
> which will have a READ_ONCE() there, and then unix_dgram_sendmsg() could use that instead?
>
We added recently skb_queue_empty_lockless() helper, to use in these contexts.
The fact that we use READ_ONCE() is more of an implementation detail I think.
Also, addressing load-stearing issues without making sure the write side
is using WRITE_ONCE() might be not enough (even if KCSAN warnings disappear)
next prev parent reply other threads:[~2020-02-03 20:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-03 18:56 Qian Cai
2020-02-03 19:41 ` Eric Dumazet
2020-02-03 20:19 ` Qian Cai
2020-02-03 20:28 ` Eric Dumazet [this message]
2020-02-03 22:34 ` Qian Cai
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=126aa227-2383-efdd-742c-6ccf85ae7ba4@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=cai@lca.pw \
--cc=davem@davemloft.net \
--cc=elver@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®