Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1251873
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] module: Prevent recursion bug caused by module RCU check |
| Date | 2015-10-20 18:50 +0200 |
| Message-ID | <qlIgN-YP-7@gated-at.bofh.it> (permalink) |
| References | <qlHXs-Cg-3@gated-at.bofh.it> <qlIgN-YP-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 20 Oct 2015 18:39:52 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Oct 20, 2015 at 12:21:03PM -0400, Steven Rostedt wrote:
> > +++ b/kernel/module.c
> > @@ -284,11 +284,25 @@ static void module_assert_mutex(void)
> > static void module_assert_mutex_or_preempt(void)
> > {
> > #ifdef CONFIG_LOCKDEP
> > + static int once;
> > +
> > if (unlikely(!debug_locks))
> > return;
> >
> > - WARN_ON(!rcu_read_lock_sched_held() &&
> > - !lockdep_is_held(&module_mutex));
> > + /*
> > + * Would be nice to use WARN_ON_ONCE(), but the warning
> > + * that causes a stack trace may call __module_address()
> > + * which may call here, and we trigger the warning again,
> > + * before the WARN_ON_ONCE() updates its flag.
> > + * To prevent the recursion, we need to open code the
> > + * once logic.
> > + */
> > + if (!once &&
> > + unlikely(!rcu_read_lock_sched_held() &&
> > + !lockdep_is_held(&module_mutex))) {
> > + once++;
>
> once = 1;
>
> is more 'once' :-) Otherwise its once every 4-odd billion.
Once it's not 0, it never gets incremented again.
-- Steve
>
> > + WARN_ON(1);
> > + }
> > #endif
> > }
> >
--
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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] module: Prevent recursion bug caused by module RCU check Steven Rostedt <rostedt@goodmis.org> - 2015-10-20 18:30 +0200
Re: [PATCH] module: Prevent recursion bug caused by module RCU check Steven Rostedt <rostedt@goodmis.org> - 2015-10-20 18:50 +0200
Re: [PATCH] module: Prevent recursion bug caused by module RCU check Peter Zijlstra <peterz@infradead.org> - 2015-10-20 19:00 +0200
Re: [PATCH] module: Prevent recursion bug caused by module RCU check Peter Zijlstra <peterz@infradead.org> - 2015-10-20 18:50 +0200
Re: [PATCH] module: Prevent recursion bug caused by module RCU check Peter Zijlstra <peterz@infradead.org> - 2015-10-20 19:00 +0200
Re: [PATCH] module: Prevent recursion bug caused by module RCU check Peter Zijlstra <peterz@infradead.org> - 2015-10-20 19:10 +0200
Re: [PATCH] module: Prevent recursion bug caused by module RCU check Steven Rostedt <rostedt@goodmis.org> - 2015-10-20 20:30 +0200
Re: [PATCH] module: Prevent recursion bug caused by module RCU check Rusty Russell <rusty@rustcorp.com.au> - 2015-10-21 07:10 +0200
csiph-web