Re: [PATCH] Fix BUG: using smp_processor_id() in preemptible codein print_fatal_signal()
From: Ingo Molnar
Date: Mon Jan 26 2009 - 18:38:19 EST
* Ed Swierk <eswierk@xxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 2009-01-27 at 00:15 +0100, Ingo Molnar wrote:
> > This trades a (harmless) debug warning against a potential deadlock or
> > even a crash, because print_fatal_signal() can do this:
> >
> > __get_user(insn, (unsigned char *)(regs->ip + i));
> >
> > which will work without a fault most of the time but might also generate a
> > pagefault and schedule away from atomic context.
>
> Ouch!
>
> > So please add preempt_disable()+preempt_enable() calls around the
> > show_regs() call instead.
>
> Take 2:
>
> With print-fatal-signals=1 on a kernel with CONFIG_PREEMPT=y, sending an
> unexpected signal to a process causes a BUG: using smp_processor_id() in
> preemptible code.
>
> get_signal_to_deliver() releases the siglock before calling
> print_fatal_signal(), which calls show_regs(), which calls
> smp_processor_id(), which is not supposed to be called from a
> preemptible thread.
>
> Signed-off-by: Ed Swierk <eswierk@xxxxxxxxxxxxxxxxxx>
applied to tip/core/urgent, thanks Ed!
You can track/test your fix via the -tip tree's tip/master branch:
http://people.redhat.com/mingo/tip.git/README
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/