[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <126aa227-2383-efdd-742c-6ccf85ae7ba4@gmail.com>
Date: Mon, 3 Feb 2020 12:28:52 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Qian Cai <cai@....pw>, Eric Dumazet <eric.dumazet@...il.com>
Cc: davem@...emloft.net, kuba@...nel.org, elver@...gle.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] skbuff: fix a data race in skb_queue_len()
On 2/3/20 12:19 PM, Qian Cai wrote:
>
>
>> On Feb 3, 2020, at 2:42 PM, Eric Dumazet <eric.dumazet@...il.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)
Powered by blists - more mailing lists