lkml.org 
[lkml]   [2020]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] skbuff: fix a data race in skb_queue_len()
From
Date


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)

\
 
 \ /
  Last update: 2020-02-03 21:29    [W:0.062 / U:22.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site