Skip to content

Commit

Permalink
signals, debug: fix BUG: using smp_processor_id() in preemptible code…
Browse files Browse the repository at this point in the history
… in print_fatal_signal()

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.

Make sure show_regs() runs with preemption disabled.

Signed-off-by: Ed Swierk <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Ed Swierk authored and Ingo Molnar committed Jan 26, 2009
1 parent bf50c90 commit 3a9f84d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,9 @@ static void print_fatal_signal(struct pt_regs *regs, int signr)
}
#endif
printk("\n");
preempt_disable();
show_regs(regs);
preempt_enable();
}

static int __init setup_print_fatal_signals(char *str)
Expand Down

0 comments on commit 3a9f84d

Please sign in to comment.