[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b4d9778e-a486-a59b-7ed2-97509722b70e@gmail.com>
Date: Mon, 9 Apr 2018 08:08:29 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>, edumazet@...gle.com
Cc: netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net] inetpeer: fix uninit-value in inet_getpeer
On 04/09/2018 07:58 AM, David Miller wrote:
> From: Eric Dumazet <edumazet@...gle.com>
> Date: Mon, 9 Apr 2018 06:43:27 -0700
>
>> syzbot/KMSAN reported that p->dtime was read while it was
>> not yet initialized in :
>>
>> delta = (__u32)jiffies - p->dtime;
>> if (delta < ttl || !refcount_dec_if_one(&p->refcnt))
>> gc_stack[i] = NULL;
>>
>> This is a false positive, because the inetpeer wont be erased
>> from rb-tree if the refcount_dec_if_one(&p->refcnt) does not
>> succeed. And this wont happen before first inet_putpeer() call
>> for this inetpeer has been done, and ->dtime field is written
>> exactly before the refcount_dec_and_test(&p->refcnt).
>>
>> The KMSAN report was :
> ...
>> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
>> Reported-by: syzbot <syzkaller@...glegroups.com>
>
> Applied, but it looks like we are just adding assignments simply
> to placate these reports when the tools and facilities cannot
> see through the logic properly.
>
To be fair, this is because the check on ->dtime should be done a second time after
the refcount_dec_if_one(&p->refcnt)
It is a tiny race, and we do not really care given nature of inetpeer cache, best effort,
and DDOS candidate anyway.
If we purge one entry too soon, this is not a big deal.
I believe tool is fine.
Powered by blists - more mailing lists