From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755236AbbJACkH (ORCPT ); Wed, 30 Sep 2015 22:40:07 -0400 Received: from a23-79-238-175.deploy.static.akamaitechnologies.com ([23.79.238.175]:64663 "EHLO prod-mail-xrelay07.akamai.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754725AbbJACkB (ORCPT ); Wed, 30 Sep 2015 22:40:01 -0400 Message-ID: <560C9CFE.6090509@akamai.com> Date: Wed, 30 Sep 2015 22:39:58 -0400 From: Jason Baron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Mathias Krause CC: netdev@vger.kernel.org, "linux-kernel@vger.kernel.org" , Eric Wong , Eric Dumazet , Rainer Weikusat , Alexander Viro , Davide Libenzi , Davidlohr Bueso , Olivier Mauras , PaX Team , Linus Torvalds , "peterz@infradead.org" , "davem@davemloft.net" Subject: Re: List corruption on epoll_ctl(EPOLL_CTL_DEL) an AF_UNIX socket References: <20150913195354.GA12352@jig.fritz.box> <20150914023949.GA15012@dcvr.yhbt.net> <560AE202.4020402@akamai.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/30/2015 01:54 AM, Mathias Krause wrote: > On 29 September 2015 at 21:09, Jason Baron wrote: >> However, if we call connect on socket 's', to connect to a new socket 'o2', we >> drop the reference on the original socket 'o'. Thus, we can now close socket >> 'o' without unregistering from epoll. Then, when we either close the ep >> or unregister 'o', we end up with this list corruption. Thus, this is not a >> race per se, but can be triggered sequentially. > > Sounds profound, but the reproducers calls connect only once per > socket. So there is no "connect to a new socket", no? > But w/e, see below. Yes, but it can be reproduced this way too. It can also happen with a close() on the remote peer 'o', and a send to 'o' from 's', which the reproducer can do as pointed out Michal. The patch I sent deals with both cases. Thanks, -Jason