From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751704AbcAZVKP (ORCPT ); Tue, 26 Jan 2016 16:10:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55743 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbcAZVKL (ORCPT ); Tue, 26 Jan 2016 16:10:11 -0500 Date: Tue, 26 Jan 2016 22:10:09 +0100 From: Oleg Nesterov To: Andrew Morton Cc: Sasha Levin , linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org Subject: Re: [PATCH] signals: work around random wakeups in sigsuspend() Message-ID: <20160126211009.GA4695@redhat.com> References: <1453735306-13519-1-git-send-email-sasha.levin@oracle.com> <20160125133205.36542c86ada93761d8a9ff06@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160125133205.36542c86ada93761d8a9ff06@linux-foundation.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/25, Andrew Morton wrote: > > On Mon, 25 Jan 2016 10:21:46 -0500 Sasha Levin wrote: > > > A random wakeup can get us out of sigsuspend() without TIF_SIGPENDING > > being set. > > > > Avoid that by making sure we were signaled, like sys_pause() does. > > What we're lacking here is any description of the end-user-visible > effects of the bug. The warning in dmesg and -ERESTARTNOHAND which we should never return to user space, although I bet nobody checks the error code returned by sigsuspend(). Plus, of course, sys_sigsuspend() can return while it should not. > Enough for people to be able to decide (and to > recognize!) whether their kernel needs this patch. I don't think this problem is really serious, plus it is very unlikely. The spurious return from sigsuspend() should not really hurt. 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.. Oleg.