Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp851016ybi; Thu, 30 May 2019 07:42:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/JhoQJuBlxK49158yEnT0aN5SizFH9GuLcqi5l1A1bGF8QH61Ua+4NONog1oLBB/Go8pw X-Received: by 2002:a17:90a:32c1:: with SMTP id l59mr3807265pjb.1.1559227379585; Thu, 30 May 2019 07:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559227379; cv=none; d=google.com; s=arc-20160816; b=n5Q8NUcWQVU3h3ViLKO8pl8svRtgj3D+RGTFNdXhBRUwOioM4suIXezcBbvrlBISOi 0AoB2WMa5ZYe8o4yNEa/lLNXQ/Fl7WCyGTTE40tcLQLI3rrCoG4G05Uh8JNhufEP/yAB zkg5rxcKrOKJo8aHdO/NIpOMVrlNUXsT+nMwrOtN/dpeKZH/79xTPF9q1jg3dfknB2r7 1P5StorM1sE3YzwEygzV9SGy2A8fgbWHsDT+1FwsP4JXYHSVMlRH8Kw1VQB10sROl+EB 9CES/mKjhROYMUl41ir3TpyYdZ9a55cxbFG9Rplv9x19BOs6yjHxD8Lu6GDIbSBFio/7 px+Q== 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=049R56j+bCZcYIK6+fg9WcZ8zcqcwNSdxtOgr6vH6cg=; b=RWX6alXnW0Le9RMNwjd3q+aZZSRgudxFfsMP/w2lhqmalZV6AQEGeMlBjA3VsKtC9z YfdUCWeO/mthsqbYlqVgGmtBTKjp0jAfpP7r80tpdFv07ALYFL78d2rkZULqFMitK8xa DoeO3LBEFSBSM/dVfsueiRWQiEaKite3NwTZhYkdp38JE+85wUvYQlk7RPFhoAkiZ0Ec GPLe2VJcqXUcXi2Y599QI0oA2qjzkRDB1BJP7SxcLYqOrCw8uO1CVJ61qEH2vVO63Uqt md5FgELkRp2TUtn3SgNxna5UzCWoEmARu2Y6Dly1IaMqNRgJ76HI6HUopvh5TzCvBdD3 DWxw== 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 y10si2836054pjr.109.2019.05.30.07.42.41; Thu, 30 May 2019 07:42: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727179AbfE3Ok6 (ORCPT + 99 others); Thu, 30 May 2019 10:40:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38970 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbfE3Ok6 (ORCPT ); Thu, 30 May 2019 10:40:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF0D5C04FFF6; Thu, 30 May 2019 14:40:51 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.159]) by smtp.corp.redhat.com (Postfix) with SMTP id 655AE611A1; Thu, 30 May 2019 14:40:46 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 30 May 2019 16:40:51 +0200 (CEST) Date: Thu, 30 May 2019 16:40:45 +0200 From: Oleg Nesterov To: Arnd Bergmann Cc: Deepa Dinamani , Al Viro , "Eric W. Biederman" , Linus Torvalds , Linux Kernel Mailing List , Andrew Morton , dbueso@suse.de, Jens Axboe , Davidlohr Bueso , e@80x24.org, Jason Baron , Linux FS-devel Mailing List , linux-aio , omar.kilani@gmail.com, Thomas Gleixner , "# 3.4.x" Subject: Re: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask()) Message-ID: <20190530144044.GG22536@redhat.com> References: <20190522032144.10995-1-deepa.kernel@gmail.com> <20190529161157.GA27659@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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 30 May 2019 14:40:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/30, Arnd Bergmann wrote: > > I think this is a nice simplification, but it would help not to mix up the > minimal regression fix with the rewrite of those functions. Yes, yes, agreed. Plus every file touched by this patch asks for more cleanups. Say, do_poll() should return -ERESTARTNOHAND, not -EINTR, after that we can remove the ugly EINTR->ERESTARTNOHAND in its callers. And more. > For the stable > kernels, I think we want just the addition of the 'bool interrupted' argument > to restore_user_sigmask() or simply revert this patch. I will check if this is possible today... At first glance 854a6ed56839a40f6 fixed another bug by accident, do_pselect() did "ret == -ERESTARTNOHAND" after "ret = poll_select_copy_remaining()" which can turn ERESTARTNOHAND into EINTR, but this is simple. I'll check tomorrow. > > - ret = set_user_sigmask(ksig.sigmask, &ksigmask, &sigsaved, ksig.sigsetsize); > > + ret = set_xxx(ksig.sigmask, ksig.sigsetsize); > > if (ret) > > return ret; > > > > ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &ts : NULL); > > - restore_user_sigmask(ksig.sigmask, &sigsaved); > > - if (signal_pending(current) && !ret) > > + > > + interrupted = signal_pending(current); > > + update_xxx(interrupted); > > Maybe name this > > restore_saved_sigmask_if(!interrupted); Yes, I thought about restore_if(), but to me restore_saved_sigmask_if(ret != -EINTR); doesn't look readable... May be restore_saved_sigmask_unless(ret == -EINTR); ? but actually I agree with any naming. > and make restore_saved_sigmask_if() an inline function > next to restore_saved_sigmask()? agreed, > With some of the recent discussions about compat syscall handling, > I now think that we want to just fold set_compat_user_sigmask() > into set_user_sigmask() agreed, and I thought about this too. But again, I'd prefer to do this and other cleanups later, on top of this patch. Oleg.