From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932446AbcBYILu (ORCPT ); Thu, 25 Feb 2016 03:11:50 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:48733 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759932AbcBYILt (ORCPT ); Thu, 25 Feb 2016 03:11:49 -0500 Date: Thu, 25 Feb 2016 09:11:44 +0100 From: Peter Zijlstra To: Al Viro Cc: Oleg Nesterov , Sasha Levin , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, mingo@kernel.org Subject: Re: [PATCH] signals: work around random wakeups in sigsuspend() Message-ID: <20160225081144.GX6357@twins.programming.kicks-ass.net> References: <1453735306-13519-1-git-send-email-sasha.levin@oracle.com> <20160125190915.GA9362@redhat.com> <20160225031852.GV17997@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160225031852.GV17997@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2016 at 03:18:52AM +0000, Al Viro wrote: > On Mon, Jan 25, 2016 at 08:09:15PM +0100, Oleg Nesterov wrote: > > On 01/25, Sasha Levin wrote: > > > > > > A random wakeup can get us out of sigsuspend() without TIF_SIGPENDING > > > being set. > > > > and TIF_RESTORE_SIGMASK is just wrong in this case. I'd say this is the > > bugfix, not work-around ;) > > > > > Avoid that by making sure we were signaled, like sys_pause() does. > > > > > > Signed-off-by: Sasha Levin > > > > Acked-by: Oleg Nesterov > > > > Thanks Sasha. > > Out of curiousity - where did that stray wakeup come from? PTRACE_KILL > used to trigger those, but that got fixed. How does one trigger that > kind of bugs on the current kernels? Its a regular TASK_INTERRUPTIBLE sleep, for those spurious wakeups are not a bug, they're pretty fundamentally allowed. See: lkml.kernel.org/r/CA+55aFwHkOo+YGWKYROmce1-H_uG3KfEUmCkJUerTj=ojY2H6Q@mail.gmail.com But they became a lot more common because we explicitly used the delayed wakeup pattern described there with wake_q. See commits: 7675104990ed ("sched: Implement lockless wake-queues") 1d0dcb3ad9d3 ("futex: Implement lockless wakeups")