Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6507475ybi; Wed, 5 Jun 2019 01:59:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqySNBlykFs+lEhX4Kb7RsJ+OcUDQ/UNnV6vLM/lvxwyxN9SqHbr851exGBZdmruKYlgpIII X-Received: by 2002:aa7:86c1:: with SMTP id h1mr29857304pfo.157.1559725146109; Wed, 05 Jun 2019 01:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559725146; cv=none; d=google.com; s=arc-20160816; b=VewjEUNo3DFAiC5u9L32k1WoESzHCkNZb5EdyZDJyJ4KlYbTf9OKERsPPN4WYhFw0C M8TXUPqQPHzgFpJ2eB9ToVTGUaBEPCIW35D5qI0I3Fsm+IZZfD6zI8nmM7u5wh1M2+21 caCVhMsTjnNr0/J6ukAutPlHXAkVTVizGZ8eSilhkN12KV4OY0xnFuAVSlvbdl775VnK p+diXD8zq0mTmQZtWp9A7ET4RtARvYdi45ixClGxSO2iIQLGQre6v7ie4TKz0BZGnHIF 0b9DJ09losKRnupjzjsQfITGgMyjW+sJn/eqwuASsYX8u7nZYGgb/EZeqh6J3QIACghq sAag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=n89SsM/3Jtjzau36LauIQ8K5NVo7EEOUNud6EdsDQqA=; b=mrGu8yyh1SXxb4mzSD47lWQkj3VhZTyFms+tVhdmot7ZuHpYIj5VCHEthDYQsQVYrL MQaIF+lc3KscPi6UuKpzOc4FOxOPvLrc//pKam8rs18RnBsfwXMUlZQNL1Y1wgg9wqTb WhfbBr3Meke583OctzTgWrz1C4hYZ+qvZLEv0mPKsZZ4EpHKXEy7KkweywIpLNVgUs9b qSmHaCevp/m5bMJNnxxyzPc4+7eZJEK87m1lhngG2o60/dQN7Bkfu0Dz2QcoUnu7pZqN bdhik2BybfI0l2uv8R7iuwU3pJu8b3BE8U23wG8X7QS4+C2hky8VV0g3K7UMQfeRjV4Q v5kA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4si29927203pfn.197.2019.06.05.01.58.50; Wed, 05 Jun 2019 01:59:06 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbfFEI4U (ORCPT + 99 others); Wed, 5 Jun 2019 04:56:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60380 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbfFEI4U (ORCPT ); Wed, 5 Jun 2019 04:56:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C53788307; Wed, 5 Jun 2019 08:56:14 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.159]) by smtp.corp.redhat.com (Postfix) with SMTP id 76A465D705; Wed, 5 Jun 2019 08:56:06 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 5 Jun 2019 10:56:12 +0200 (CEST) Date: Wed, 5 Jun 2019 10:56:04 +0200 From: Oleg Nesterov To: Linus Torvalds Cc: Andrew Morton , Deepa Dinamani , Linux List Kernel Mailing , Arnd Bergmann , Davidlohr Bueso , Jens Axboe , Davidlohr Bueso , e@80x24.org, Jason Baron , linux-fsdevel , linux-aio@kvack.org, omar.kilani@gmail.com, Thomas Gleixner , stable , Al Viro , "Eric W. Biederman" , David Laight Subject: Re: [PATCH] signal: remove the wrong signal_pending() check in restore_user_sigmask() Message-ID: <20190605085604.GA32406@redhat.com> References: <20190522032144.10995-1-deepa.kernel@gmail.com> <20190529161157.GA27659@redhat.com> <20190604134117.GA29963@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 05 Jun 2019 08:56:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/04, Linus Torvalds wrote: > > On Tue, Jun 4, 2019 at 6:41 AM Oleg Nesterov wrote: > > > > This is the minimal fix for stable, I'll send cleanups later. > > Ugh. I htink this is correct, but I wish we had a better and more > intuitive interface. Yes, > In particular, since restore_user_sigmask() basically wants to check > for "signal_pending()" anyway No, the caller should check signal_pending() anyway and this is enough. > > - restore_user_sigmask(ksig.sigmask, &sigsaved); > > - if (signal_pending(current) && !ret) > > + > > + interrupted = signal_pending(current); > > + restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); > > + if (interrupted && !ret) > > ret = -ERESTARTNOHAND; > > are wrong to begin with, This is fs/aio.c and I have already mentioned that this code doesn't look right anyway. > IOW, I think the above could become > > ret = restore_user_sigmask(ksig.sigmask, &sigsaved, ret, -ERESTARTHAND); > > instead if we just made the right interface decision. I think this particular code should simply do ret = do_io_getevents(...); if (ret == -ERESTARTSYS) ret = -EINTR; restore_user_sigmask(ret == -EINTR); However I agree that another helper(s) which takes/returns the error code makes sense and I was going to do this. Lets do this step by step, I think we should kill sigmask/sigsaved first. Oleg.