Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp935674ybi; Thu, 30 May 2019 08:59:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYV+pt6Xhn0JAUD9h9on3IHDe0AXLpa/FK2P6HdSUiQCLRqnRGw/84yoVSiAYTr8/1tMES X-Received: by 2002:a17:902:e490:: with SMTP id cj16mr4336733plb.136.1559231952054; Thu, 30 May 2019 08:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559231952; cv=none; d=google.com; s=arc-20160816; b=j1OlbeUhblTKyT9DAjkeSSienGhciIpvHbiKTxqKX7sEfQt+BfWjUDy37rvbHqXs/h WaHA0QnoIMz9R36el81a7h7oHXzDrPoIK4pSKuI/VNQk63ShjA4XzuxGu0stRTco5v7v XqsZzT9pKGC93vRluFfkl3kxOel7z0IZGj8Rq94ASLDTV1y7w6Bj6q7njXVdwQ8NXak7 lEmIZrIHrzEOPHwdVhWT3JkjgIceq7CJAJ/q6zBGhLnl0MsT8Rmh8SwCCgpSDeLNXSMS 1Ha4mIDmCFdIjdRWOaHnqb3+sCvr6/dNtDOuWz5JVQV9H89X/Hk3JEbms4xhsfn6U0Am CaWQ== 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=2MUL2W7lduHkYnqjgcfbPLjIg5Gq3ZwdxOC9iBIIcnE=; b=00FCZgtOyegP4MEdPpVw315moZ0WMW5CJAxO4cbf3ZxVu3UD7SG9He04Oeh9E1JY4L QvPFzrumfG1DhCL4G1HY0PbJtcgZCl5HymiApsGBKrwI5P9iJSZNbq1xUs7GVdascD6J TpQ+zfjb7JO336MTxnODZhokNhokS0aLemOUqSJbw3SYhZIkSReXIYiVQL+ahWuYdBKx CT1dBEZqvfoDRm+/+XMxi+JRDD+Nm1GOHML5KQMpjm0/VwsS5+QIe1rTuIn1z/XLHfS6 5305v68JqSVRZ488yi/F337MraC0Lh2ZmEzJEgKECgjjK6L0p2DSfIADegnou7EFeGOt RHuw== 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 g17si3337117pgi.569.2019.05.30.08.58.53; Thu, 30 May 2019 08:59:12 -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 S1726520AbfE3P5p (ORCPT + 99 others); Thu, 30 May 2019 11:57:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52440 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbfE3P5p (ORCPT ); Thu, 30 May 2019 11:57:45 -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 ABA9830C1FEB; Thu, 30 May 2019 15:57:22 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.159]) by smtp.corp.redhat.com (Postfix) with SMTP id 4847E7A026; Thu, 30 May 2019 15:57:17 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 30 May 2019 17:57:22 +0200 (CEST) Date: Thu, 30 May 2019 17:57:16 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: Deepa Dinamani , Al Viro , Linus Torvalds , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, arnd@arndb.de, dbueso@suse.de, axboe@kernel.dk, dave@stgolabs.net, e@80x24.org, jbaron@akamai.com, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, omar.kilani@gmail.com, tglx@linutronix.de, stable@vger.kernel.org Subject: Re: pselect/etc semantics Message-ID: <20190530155715.GH22536@redhat.com> References: <20190522032144.10995-1-deepa.kernel@gmail.com> <20190529161157.GA27659@redhat.com> <87woi8rt96.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87woi8rt96.fsf@xmission.com> 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.43]); Thu, 30 May 2019 15:57:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/30, Eric W. Biederman wrote: > > Oleg Nesterov writes: > > > Al, Linus, Eric, please help. > > > > The previous discussion was very confusing, we simply can not understand each > > other. > > > > To me everything looks very simple and clear, but perhaps I missed something > > obvious? Please correct me. > > If I have read this thread correctly the core issue is that ther is a > program that used to work and that fails now. The question is why. I didn't even try to investigate, I wasn't cc'ed initially and I then I had enough confusion when I started to look at the patch. However, 854a6ed56839a40f6 obviously introduced the user-visible change so I am not surprised it breaks something. And yes, personally I think this change is not right. > Which means I believe we have a semantically valid change in behavior > that is causing a regression. See below, > void restore_user_sigmask(const void __user *usigmask, sigset_t *sigsaved) > { > > if (!usigmask) > return; > /* > * When signals are pending, do not restore them here. > * Restoring sigmask here can lead to delivering signals that the above > * syscalls are intended to block because of the sigmask passed in. > */ > if (signal_pending(current)) { > current->saved_sigmask = *sigsaved; > set_restore_sigmask(); > return; > } > > /* > * This is needed because the fast syscall return path does not restore > * saved_sigmask when signals are not pending. > */ > set_current_blocked(sigsaved); > } > > Which has been reported results in a return value of 0, 0 or success > and a signal > delivered, where previously that did not happen. Yes. And to me this doesn't look right. OK, OK, probably this is because I never read the docs, only the source code in fs/select.c. But to me pselect() should either return success/timeout or deliver a signal. Not both. Even if the signal was already pending before pselect() was called. To clarify, "a signal" means a signal which was blocked before pselect(sigmask) and temporary unblocked in this syscall. And even if this doesn't violate posix, I see no reason to change the historic behaviour. And this regression probably means we can't ;) Oleg.