Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6508329yba; Wed, 1 May 2019 13:50:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtKcp4cOtu1kFROxY/RZYnHxidVwQGlnck+2BWLoQ6p+EIhIuSZYaTu1gyeEG8EJBm4Yef X-Received: by 2002:a17:902:61:: with SMTP id 88mr78122986pla.166.1556743859223; Wed, 01 May 2019 13:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556743859; cv=none; d=google.com; s=arc-20160816; b=vy9y6T1poUXF1sF2/u+GrC/QaMD79n7OTnaJi2zciw+B0yTk+2O3nnOr6FAGhyyeZt RZj//YxoJXLda2hSnQ0wgHhp8dF2Y3EPTztUS6KA/n4UaV4Kn8/aDlXrbdjUPUyZmUpS WXSCaiPrk6n3FJoIdt0LuTOCGNm1FLI6mVSPb+Fr7K7vWM1jUJX9gDfOFrxbb2+YyUBn i97He2CaKE9wAXhFNHC1FGH1O5GA/3GpD32YdnMkueIlH6yaY27ug4jbmuAMfO9GJzQu v3LBstBPHHx4dxekf14Hcug9eQpr6QUR4m8BxgiMZfX5lg9rpjPkfrEmKKrtQhmSzsH7 3fjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=T5BPecyXwBVE5rsDKjW7YaVWq4BPd2xL0hHZS+qChnE=; b=bM/etjeykqAdtYPAUcpec8TpJquLxi46oEFj8ImgeJ7jQPCtPQ99u37JxLer3j3ehu AgPyN1IVmRFbOo1CK1x7b/Mvb9debRcnTsaCLcSWkEmjdTy0k8Jfk99feOa36agQ46EC TVNjj0p2TtwBP7VWyMlG2GqzkFvyVbxiS0hdHKTy7MZ24U1OLeGJ3Px9bi8Nc7A7T4ro ZLKfMClt5ozZLzdzfiCG2VH7YCaHMmzcgKxwqY+PerHqQqJphv+9QEuQSLJhK4Z/XQBQ OZO1yPkSbUeWjq1TAj/xqOjdwtg4xDvBiw2cJEROiw3AhD1PrsuXnlc+OpqRBtjhrHf2 15NQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z29si9971612pgl.584.2019.05.01.13.50.43; Wed, 01 May 2019 13:50:59 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726188AbfEAUs1 (ORCPT + 99 others); Wed, 1 May 2019 16:48:27 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:56320 "EHLO dcvr.yhbt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbfEAUs1 (ORCPT ); Wed, 1 May 2019 16:48:27 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E8A611F453; Wed, 1 May 2019 20:48:26 +0000 (UTC) Date: Wed, 1 May 2019 20:48:26 +0000 From: Eric Wong To: Deepa Dinamani Cc: Davidlohr Bueso , Arnd Bergmann , Al Viro , Jason Baron , Linux Kernel Mailing List , Omar Kilani , Linux FS-devel Mailing List Subject: Re: Strange issues with epoll since 5.0 Message-ID: <20190501204826.umekxc7oynslakes@dcvr> References: <20190424193903.swlfmfuo6cqnpkwa@dcvr> <20190427093319.sgicqik2oqkez3wk@dcvr> <20190428004858.el3yk6hljloeoxza@dcvr> <20190429204754.hkz7z736tdk4ucum@linux-r8p5> <20190429210427.dmfemfft2t2gdwko@dcvr> <20190501021405.hfvd7ps623liu25i@dcvr> <20190501073906.ekqr7xbw3qkfgv56@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Deepa Dinamani wrote: > So here is my analysis: > So the 854a6ed56839a40f6 seems to be better than the original code in > that it detects the signal. OTOH, does matter to anybody that a signal is detected slightly sooner than it would've been, otherwise? > But, the problem is that it doesn't > communicate it to the userspace. Yup, that's a big problem :) > So a patch like below solves the problem. This is incomplete. I'll > verify and send you a proper fix you can test soon. This is just for > the sake of discussion: > > diff --git a/fs/eventpoll.c b/fs/eventpoll.c > index 4a0e98d87fcc..63a387329c3d 100644 > --- a/fs/eventpoll.c > +++ b/fs/eventpoll.c > @@ -2317,7 +2317,7 @@ SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct > epoll_event __user *, events, > int, maxevents, int, timeout, const sigset_t __user *, sigmask, > size_t, sigsetsize) > { > - int error; > + int error, signal_detected; > sigset_t ksigmask, sigsaved; > > /* > @@ -2330,7 +2330,10 @@ SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct > epoll_event __user *, events, > > error = do_epoll_wait(epfd, events, maxevents, timeout); > > - restore_user_sigmask(sigmask, &sigsaved); > + signal_detected = restore_user_sigmask(sigmask, &sigsaved); > + > + if (signal_detected && !error) > + return -EITNR; > > return error; Looks like a reasonable API. > @@ -2862,7 +2862,7 @@ void restore_user_sigmask(const void __user > *usigmask, sigset_t *sigsaved) > if (signal_pending(current)) { > current->saved_sigmask = *sigsaved; > set_restore_sigmask(); > - return; > + return 0; Shouldn't that "return 1" if a signal is pending?