Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2054123ybl; Sat, 1 Feb 2020 12:21:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwfSOsRGctqEMcRXLbTYetWjhCXYW/b7S7OI0WaNmAsuDU0wU2RR5webAS75IM387wQQX5R X-Received: by 2002:a05:6830:1d8b:: with SMTP id y11mr3692867oti.4.1580588513015; Sat, 01 Feb 2020 12:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580588513; cv=none; d=google.com; s=arc-20160816; b=Ee1/qT0yuCfKj1KUhAGNj+nN/M35JnnWir9J3jYiBqDmAr4Wr9SJpfphDv1kRWAmQW 2GgMuuNbDq3HmCQFxaehmy7ZK5jJMvzLaG8kePdAhcAOIt83JcG9ajJaRgB28lHJksCz IGMlIKQ2Cyr1khvsjZHWXrgJQ2V4pDjEnFsrhLWARnMvD+0kW+Pl1OFrLIPfhXM5SJdQ pbwelTKUnSfDXKLO17VNlg7zYbQkQJr4Zq/C48ixHVB/bZrF11pEYgjGBH6C6xba0umZ 3FBY8qUlz9lvYpnlGtsnwPUpeHx4VoqT5ig34BO1FCHy426iS1Te82i7hQlNerToNtCs 23lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=dqxts5iqErhC50J90nr2RLLBpTCk5PcZ5XJShJm0Q+g=; b=oKDIeCVdPiZ4qa4331o7MNOKK+y1/5YWmdPgI01o/VV5C7lqhZ32lcxrz0iQGKEkdn vHus23Yith8Lx+w5HXFxwG2prjn1H1PS1f52cy/S5QXSQOxpf6fxoPlA6P3apcvnkVVn skpGYuyB4Kw15NTJW2zWZO1zs9J8Bjn9w4/5HONwHHzxkXQd9ukhf1//NKmVcsUayrcq MuooHWoePXKQR+voswf5BmO6QHV+r8lMYhL6kMqgIzKr5OADcwuG5KJpkaUMlVaC9OFE wKIBVp9gXf+3fwoM6nlg840i/5dr8TLwDQtcVR/BbcoHi5FZUW5xrSl/XOSLuewq4+rD iesw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zRT1I2dd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si5628994oih.70.2020.02.01.12.21.25; Sat, 01 Feb 2020 12:21:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zRT1I2dd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726718AbgBAUQt (ORCPT + 99 others); Sat, 1 Feb 2020 15:16:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:55114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbgBAUQt (ORCPT ); Sat, 1 Feb 2020 15:16:49 -0500 Received: from cakuba.hsd1.ca.comcast.net (c-73-93-4-247.hsd1.ca.comcast.net [73.93.4.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB2AE2063A; Sat, 1 Feb 2020 20:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580588208; bh=Cphzme7FJDa/dMLNujqQClVMgMlU0vm1Jshw6MLTCl8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=zRT1I2ddoCsdYinizDObWHOjl8gPlNGlCKclMvV7Xut57v71PPe+QdOJiSdxsDrKj ViHVnbIl9wSvCzfiXicsxEtEMKp2FO4kiQF+8JWCr9VH+kj7MuUazeZY4raX6eDxuV tdeoJx7kmX8hurFK/cxkvuOSjHbskPQ4NpwW/UFc= Date: Sat, 1 Feb 2020 12:16:47 -0800 From: Jakub Kicinski To: Max Neunhoeffer Cc: netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, LKML Subject: Re: epoll_wait misses edge-triggered eventfd events: bug in Linux 5.3 and 5.4 Message-ID: <20200201121647.62914697@cakuba.hsd1.ca.comcast.net> In-Reply-To: <20200131135730.ezwtgxddjpuczpwy@tux> References: <20200131135730.ezwtgxddjpuczpwy@tux> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 31 Jan 2020 14:57:30 +0100, Max Neunhoeffer wrote: > Dear All, > > I believe I have found a bug in Linux 5.3 and 5.4 in epoll_wait/epoll_ctl > when an eventfd together with edge-triggered or the EPOLLONESHOT policy > is used. If an epoll_ctl call to rearm the eventfd happens approximately > at the same time as the epoll_wait goes to sleep, the event can be lost, > even though proper protection through a mutex is employed. > > The details together with two programs showing the problem can be found > here: > > https://bugzilla.kernel.org/show_bug.cgi?id=205933 > > Older kernels seem not to have this problem, although I did not test all > versions. I know that 4.15 and 5.0 do not show the problem. > > Note that this method of using epoll_wait/eventfd is used by > boost::asio to wake up event loops in case a new completion handler > is posted to an io_service, so this is probably relevant for many > applications. > > Any help with this would be appreciated. Could be networking related but let's CC FS folks just in case. Would you be able to perform bisection to narrow down the search for a buggy change?