Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759541AbcLAQlS (ORCPT ); Thu, 1 Dec 2016 11:41:18 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:50011 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753936AbcLAQlR (ORCPT ); Thu, 1 Dec 2016 11:41:17 -0500 Date: Thu, 1 Dec 2016 17:41:07 +0100 From: Peter Zijlstra To: "Paul E. McKenney" Cc: Josh Poimboeuf , Petr Mladek , Vince Weaver , "linux-kernel@vger.kernel.org" , Ingo Molnar , Arnaldo Carvalho de Melo , "dvyukov@google.com" Subject: Re: perf: fuzzer BUG: KASAN: stack-out-of-bounds in __unwind_start Message-ID: <20161201164107.GN3092@twins.programming.kicks-ass.net> References: <20161129151004.GU3924@linux.vnet.ibm.com> <20161129162920.GF21230@pathway.suse.cz> <20161129171038.GN3092@twins.programming.kicks-ass.net> <20161129193935.GE3924@linux.vnet.ibm.com> <20161129195204.GG3045@worktop.programming.kicks-ass.net> <20161129200711.GF3924@linux.vnet.ibm.com> <20161129203259.GA28037@linux.vnet.ibm.com> <20161130191303.prvrgkvijqzydexg@treble> <20161201055235.GG3092@twins.programming.kicks-ass.net> <20161201123316.GZ3924@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161201123316.GZ3924@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1142 Lines: 28 On Thu, Dec 01, 2016 at 04:33:16AM -0800, Paul E. McKenney wrote: > On Thu, Dec 01, 2016 at 06:52:35AM +0100, Peter Zijlstra wrote: > > On Wed, Nov 30, 2016 at 01:13:03PM -0600, Josh Poimboeuf wrote: > > > This question was probably intended for other folks, but I should point > > > out that idle tasks *do* invoke the scheduler. cpu_idle_loop() calls > > > schedule_preempt_disabled(). > > > > Right, but that doesn't matter I think. The below will simply not call > > rcu_note_voluntary_context_switch() from the idle task, which would be > > fine I think. > > > > > > So is the following a sensible approach, or should I look elsewhere? > > > > > > > > #define cond_resched_rcu_qs() \ > > > > do { \ > > > > if (!is_idle_task(current) && !cond_resched()) \ > > > > rcu_note_voluntary_context_switch(current); \ > > > > You should reverse your conditions though: > > > > if (!cond_resched() && !is_idle_task(current)) > > rcu_note_voluntary_context_switch(current); > > > > That way we'll still do cond_resched() and you only gate the RCU call. > > This makes it illegal at early boot. Humm, how early are we talking?