Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1559208ybm; Tue, 21 May 2019 16:34:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqziWCN0G8MYgPakr5yJtznvRa0bK25UD6UKmuW5xty2NDSB665szpbR+twKik55DVjEbmKw X-Received: by 2002:a17:902:704c:: with SMTP id h12mr31284303plt.65.1558481678359; Tue, 21 May 2019 16:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558481678; cv=none; d=google.com; s=arc-20160816; b=XNo5RalQ2AB7pjThJ9HQP3PSd9eSneeunkCwqvOtCnBr2Ukyc7UOGdbwPzxU2NyXm1 KzozY30UpMTurufNshBYu14ELYfZgPneNaJ2Ko9m6+yVGaCkEHeOs6wouHKy69+4xExo fHwqptZW9lPQPgHTx7LAp9DtnvIqJf8Y6AA3/gDSOSAW9GbWkeEC23khiyoXzaCx3ONj ssWA0abBDCMgU/htNDYcmOd9tuQ0/CS2bkqxPD+UVx4YY3uqLt0XLw9RYfggv1kMsjqF KDZGc3KlC/re4c30alnUJ1uqUV5SBlIpGevIkdi0nxryga0nds+F3VoYj1/P8YxEZPZ3 BSww== 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=A1f5dpNma3vFX4o8lkDLDJQjRisiOm0wqqopb9+6ftM=; b=s7mh5Va4lHa1x9LeM+m5sbijt5BV0FhOtlosLYopsHKuddx+OIQgc7ZEE+A2p/SqiA peKZxQGfM85PpOtyGRI8D3XDlvIysKdEBigafgGae3tGuzfVYOgGEfVkcZhtM6h0n0ST 3MU8JIo9zqaIptCS9b9KxfzZ2nfZR0jrrbmGOlrAj5fSyp+vPwRnMzWQj+gyQJKzGg37 Li6mU9W+fZoMMKlTHFWjPuQiQJS0x+AyckJplyhc9PpfSJNnY/qUOBonYGIEzirflNXp O34N/bmg4PP/wZ9dXQwRWNL5e8xcZg7cm/phLy8cvna+aY+XyX6dCwtNQWFPhMUMUnKD GCtg== 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 bh2si23990578plb.430.2019.05.21.16.34.23; Tue, 21 May 2019 16:34:38 -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 S1728082AbfEUXdU (ORCPT + 99 others); Tue, 21 May 2019 19:33:20 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:59806 "EHLO dcvr.yhbt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726017AbfEUXdU (ORCPT ); Tue, 21 May 2019 19:33:20 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7D2A61F462; Tue, 21 May 2019 23:33:19 +0000 (UTC) Date: Tue, 21 May 2019 23:33:19 +0000 From: Eric Wong To: Andrew Morton Cc: Deepa Dinamani , linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, arnd@arndb.de, dbueso@suse.de, axboe@kernel.dk, dave@stgolabs.net, jbaron@akamai.com, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, omar.kilani@gmail.com, tglx@linutronix.de, stable@vger.kernel.org, Oleg Nesterov Subject: Re: [PATCH 1/1] signal: Adjust error codes according to restore_user_sigmask() Message-ID: <20190521233319.GA17957@dcvr> References: <20190507043954.9020-1-deepa.kernel@gmail.com> <20190521092551.fwtb6recko3tahwj@dcvr> <20190521152748.6b4cd70cf83a1183caa6aae7@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190521152748.6b4cd70cf83a1183caa6aae7@linux-foundation.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrew Morton wrote: > On Tue, 21 May 2019 09:25:51 +0000 Eric Wong wrote: > > > Deepa Dinamani wrote: > > > For all the syscalls that receive a sigmask from the userland, > > > the user sigmask is to be in effect through the syscall execution. > > > At the end of syscall, sigmask of the current process is restored > > > to what it was before the switch over to user sigmask. > > > But, for this to be true in practice, the sigmask should be restored > > > only at the the point we change the saved_sigmask. Anything before > > > that loses signals. And, anything after is just pointless as the > > > signal is already lost by restoring the sigmask. > > > > > > The inherent issue was detected because of a regression caused by > > > 854a6ed56839a. > > > The patch moved the signal_pending() check closer to restoring of the > > > user sigmask. But, it failed to update the error code accordingly. > > > > > > Detailed issue discussion permalink: > > > https://lore.kernel.org/linux-fsdevel/20190427093319.sgicqik2oqkez3wk@dcvr/ > > > > > > Note that the patch returns interrupted errors (EINTR, ERESTARTNOHAND, > > > etc) only when there is no other error. If there is a signal and an error > > > like EINVAL, the syscalls return -EINVAL rather than the interrupted > > > error codes. > > > > > > The sys_io_uring_enter() seems to be returning success when there is > > > a signal and the queue is not empty. This seems to be a bug. I will > > > follow up with a separate patch for that. > > > > > > Reported-by: Eric Wong > > > Fixes: 854a6ed56839a40f6b5d02a2962f48841482eec4 ("signal: Add restore_user_sigmask()") > > > Signed-off-by: Deepa Dinamani > > > Reviewed-by: Davidlohr Bueso > > (top-posting fixed). > > > It's been 2 weeks and this fix hasn't appeared in mmots / mmotm. > > I also noticed it's missing Cc: for stable@ (below) > > Why is a -stable backport needed? I see some talk above about lost > signals but it is unclear whether these are being observed after fixing > the regression caused by 854a6ed56839a. I guess Deepa's commit messages wasn't clear... I suggest prepending this as the first paragraph to Deepa's original message: This fixes a bug introduced with 854a6ed56839a which caused EINTR to not be reported to userspace on epoll_pwait. Failure to report EINTR to userspace caused problems with user code which relies on EINTR to run signal handlers. > IOW, can we please have a changelog which has a clear and complete > description of the user-visible effects of the change. > > And please Cc Oleg.