lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 14 Feb 2017 20:38:30 +0100 From: Dmitry Vyukov <dvyukov@...gle.com> To: Eric Dumazet <eric.dumazet@...il.com> Cc: Eric Dumazet <edumazet@...gle.com>, David Miller <davem@...emloft.net>, Alexey Kuznetsov <kuznet@....inr.ac.ru>, Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>, Patrick McHardy <kaber@...sh.net>, netdev <netdev@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>, syzkaller <syzkaller@...glegroups.com>, Andrey Ryabinin <aryabinin@...tuozzo.com> Subject: Re: net: use-after-free in tw_timer_handler On Wed, Feb 8, 2017 at 8:32 PM, Dmitry Vyukov <dvyukov@...gle.com> wrote: >>> >> >>> This code was changed a long time ago : >>> >> >>> >>> >> >>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ed2e923945892a8372ab70d2f61d364b0b6d9054 >>> >> >>> >>> >> >>> So I suspect a recent patch broke the logic. >>> >> >>> >>> >> >>> You might start a bisection : >>> >> >>> >>> >> >>> I would check if 4.7 and 4.8 trigger the issue you noticed. >>> >> >> >>> >> >> >>> >> >> It happens with too low rate for bisecting (few times per day). I >>> >> >> could add some additional checks into code, but I don't know what >>> >> >> checks could be useful. >>> >> > >>> >> > If you can not tell if 4.7 and/or 4.8 have the problem, I am not sure >>> >> > we are able to help. >>> >> >>> >> >>> >> There are also chances that the problem is older. >>> >> >>> >> Looking at the code, this part of inet_twsk_purge looks fishy: >>> >> >>> >> 285 if (unlikely((tw->tw_family != family) || >>> >> 286 atomic_read(&twsk_net(tw)->count))) { >>> >> >>> >> It uses net->count == 0 check to find the right sockets. But what if >>> >> there are several nets with count == 0 in flight, can't there be >>> >> several inet_twsk_purge calls running concurrently freeing each other >>> >> sockets? If so it looks like inet_twsk_purge can call >>> >> inet_twsk_deschedule_put twice for a socket. Namely, two calls for >>> >> different nets discover the socket, check that net->count==0 and both >>> >> call inet_twsk_deschedule_put. Shouldn't we just give inet_twsk_purge >>> >> net that it needs to purge? >>> > >>> > Yes, atomic_read() is not a proper sync point. >>> >>> Do you mean that it does not include read barrier? >>> I more mean that we can call inet_twsk_deschedule_put twice for the same socket. >> >> I meant that this code assumed RTNL being held. >> >> This might not be the case now, after some old change. > > > cleanup_net releases rtnl lock right before calling these callbacks. +Andrey, do you know somebody on your side interested in stability of network namespace? This use-after-free seems to be related to net namespace. For context, full thread is here: https://groups.google.com/forum/#!msg/syzkaller/p1tn-_Kc6l4/smuL_FMAAgAJ
Powered by blists - more mailing lists