Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbbEFKTe (ORCPT ); Wed, 6 May 2015 06:19:34 -0400 Received: from mail-wi0-f194.google.com ([209.85.212.194]:36354 "EHLO mail-wi0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751123AbbEFKTb (ORCPT ); Wed, 6 May 2015 06:19:31 -0400 From: Ingo Molnar X-Google-Original-From: Ingo Molnar Date: Wed, 6 May 2015 12:19:27 +0200 To: Oleg Nesterov Cc: Linus Torvalds , Neil Brown , Evgeniy Polyakov , Stephen Smalley , Alex Williamson , linux-kernel , kvm Subject: Re: [PATCH] signals: Generate warning when flush_signals() is called from non-kthread context Message-ID: <20150506101927.GA17291@gmail.com> References: <1430502057.4472.255.camel@redhat.com> <20150501193813.GA2812@gmail.com> <20150503173401.GA22052@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150503173401.GA22052@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 984 Lines: 37 * Oleg Nesterov wrote: > > --- a/kernel/signal.c > > +++ b/kernel/signal.c > > @@ -427,6 +427,10 @@ void flush_signals(struct task_struct *t) > > { > > unsigned long flags; > > > > + /* Only kthreads are allowed to destroy signals: */ > > + if (WARN_ON_ONCE(!(current->flags & PF_KTHREAD))) > > + return; > > + > > But I am not sure this can't make some buggy driver even more buggy. > Just suppose it does something > > do { > if (signal_pending()) > flush_signals(); > } while (wait_event_interruptible(...)); > > and this change will turn this into busy-wait loop. > > So perhaps another change which just adds WARN_ON_RATELIMIT() > without "return" will be safer? Yeah, absolutely. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/