Subject: Re: [PATCH AUTOSEL 4.19 46/84] tcp/dccp: fix possible race __inet_lookup_established()

From: Sasha Levin <[email-masked]>
Date: Thu, 9 Jan 2020 10:32:26 -0500

On Thu, Jan 02, 2020 at 01:31:22PM +0530, Naresh Kamboju wrote:
>On Fri, 27 Dec 2019 at 23:17, Sasha Levin <[email-masked]> wrote:
>>
>> From: Eric Dumazet <[email-masked]>
>>
>> [ Upstream commit 8dbd76e79a16b45b2ccb01d2f2e08dbf64e71e40 ]
>>
>> Michal Kubecek and Firo Yang did a very nice analysis of crashes
>> happening in __inet_lookup_established().
>>
>> Since a TCP socket can go from TCP_ESTABLISH to TCP_LISTEN
>> (via a close()/socket()/listen() cycle) without a RCU grace period,
>> I should not have changed listeners linkage in their hash table.
>>
>> They must use the nulls protocol (Documentation/RCU/rculist_nulls.txt),
>> so that a lookup can detect a socket in a hash list was moved in
>> another one.
>>
>> Since we added code in commit d296ba60d8e2 ("soreuseport: Resolve
>> merge conflict for v4/v6 ordering fix"), we have to add
>> hlist_nulls_add_tail_rcu() helper.
>
>The kernel panic reported on all devices,
>While running LTP syscalls accept* test cases on stable-rc-4.19 branch kernel.
>This report log extracted from qemu_x86_64.
>
>Reverting this patch re-solved kernel crash.

I'll drop it until we can look into what's happening here, thanks!

-- 
Thanks,
Sasha