mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH] module: Prevent recursion bug caused by module RCU check
Date: Tue, 20 Oct 2015 14:20:26 -0400	[thread overview]
Message-ID: <20151020142026.60e64a9e@gandalf.local.home> (raw)
In-Reply-To: <20151020170905.GV11639@twins.programming.kicks-ass.net>

On Tue, 20 Oct 2015 19:09:05 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> 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...

Hehe,

> 
> ---
>  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);				\
>  })

I thought about it too, but was too busy to think harder about it. I
may have made the same mistakes as you.

-- Steve

>  
> @@ -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);				\
>  })
>  


  reply	other threads:[~2015-10-20 18:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20 16:21 Steven Rostedt
2015-10-20 16:39 ` Peter Zijlstra
2015-10-20 16:46   ` Steven Rostedt
2015-10-20 16:56     ` Peter Zijlstra
2015-10-20 16:53   ` Peter Zijlstra
2015-10-20 17:09     ` Peter Zijlstra
2015-10-20 18:20       ` Steven Rostedt [this message]
2015-10-21  5:04       ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151020142026.60e64a9e@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®