From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933368AbcA0RZ1 (ORCPT ); Wed, 27 Jan 2016 12:25:27 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:40560 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752884AbcA0RZ0 (ORCPT ); Wed, 27 Jan 2016 12:25:26 -0500 Subject: Re: [PATCH] signals: work around random wakeups in sigsuspend() To: Peter Zijlstra , Oleg Nesterov References: <1453735306-13519-1-git-send-email-sasha.levin@oracle.com> <20160125133205.36542c86ada93761d8a9ff06@linux-foundation.org> <20160126211009.GA4695@redhat.com> <20160127084443.GL6357@twins.programming.kicks-ass.net> Cc: Andrew Morton , linux-kernel@vger.kernel.org, mingo@kernel.org From: Sasha Levin Message-ID: <56A8FD4F.5080708@oracle.com> Date: Wed, 27 Jan 2016 12:24:31 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20160127084443.GL6357@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/27/2016 03:44 AM, Peter Zijlstra wrote: > On Tue, Jan 26, 2016 at 10:10:09PM +0100, Oleg Nesterov wrote: > >> And, ironically, there is another more serious "reverse" problem ;) sigsuspend() >> orany other user of -ERESTARTNOHAND can "miss" the signal, in a sense that the >> kernel can wrongly restart this syscall after return from signal handler. This >> is not trivial to fix.. > > So I'm not entirely sure I get what you mean there. But it did get me to > look at the patch again: > > + while (!signal_pending(current)) { > + __set_current_state(TASK_INTERRUPTIBLE); > + schedule(); > + } > > That should very much be: > > for (;;) { > set_current_state(TASK_INTERRUPTIBLE); > if (signal_pending(current)) > break; > schedule(); > } > __set_current_state(TASK_RUNNING); Should that be the case for sys_pause() too? Thanks, Sasha