From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752144AbbJTRJN (ORCPT ); Tue, 20 Oct 2015 13:09:13 -0400 Received: from casper.infradead.org ([85.118.1.10]:33695 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750983AbbJTRJH (ORCPT ); Tue, 20 Oct 2015 13:09:07 -0400 Date: Tue, 20 Oct 2015 19:09:05 +0200 From: Peter Zijlstra To: Steven Rostedt Cc: "Paul E. McKenney" , LKML , Rusty Russell Subject: Re: [PATCH] module: Prevent recursion bug caused by module RCU check Message-ID: <20151020170905.GV11639@twins.programming.kicks-ass.net> References: <20151020122103.66ab250a@gandalf.local.home> <20151020163952.GI17308@twins.programming.kicks-ass.net> <20151020165331.GU11639@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151020165331.GU11639@twins.programming.kicks-ass.net> 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 Tue, Oct 20, 2015 at 06:53:31PM +0200, Peter Zijlstra wrote: > Also, would it not be better to fix WARN_ON_ONCE() instead? > Clearly I'm an idiot and should stay away from the computer... --- include/asm-generic/bug.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 630dd2372238..d0972fc8433f 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -110,9 +110,10 @@ extern void warn_slowpath_null(const char *file, const int line); static bool __section(.data.unlikely) __warned; \ int __ret_warn_once = !!(condition); \ \ - if (unlikely(__ret_warn_once)) \ - if (WARN_ON(!__warned)) \ - __warned = true; \ + if (unlikely(__ret_warn_once && !__warned)) { \ + __warned = true; \ + WARN_ON(1); \ + } \ unlikely(__ret_warn_once); \ }) @@ -120,9 +121,10 @@ extern void warn_slowpath_null(const char *file, const int line); static bool __section(.data.unlikely) __warned; \ int __ret_warn_once = !!(condition); \ \ - if (unlikely(__ret_warn_once)) \ - if (WARN(!__warned, format)) \ - __warned = true; \ + if (unlikely(__ret_warn_once && !__warned)) { \ + __warned = true; \ + WARN(1, format); \ + } \ unlikely(__ret_warn_once); \ })