lkml.org 
[lkml]   [2015]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] module: Prevent recursion bug caused by module RCU check
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); \
> })
>



\
 
 \ /
  Last update: 2015-10-20 20:41    [W:0.063 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site