diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-12-20 19:27:19 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-12-20 19:27:19 -0500 |
commit | c0a698b7443a9fce76b0a849f06c45ac78f3b0a0 (patch) | |
tree | ce528f832d075920f1030206a1fd016d7bf215eb | |
parent | faa4877f023bafa35239d411b160955dc0629fe9 (diff) |
x86: fix die() to not be preemptible
Andrew "Eagle Eye" Morton noticed that we use raw_local_save_flags()
instead of raw_local_irq_save(flags) in die(). This allows the
preemption of oopsing contexts - which is highly undesirable. It also
causes CONFIG_DEBUG_PREEMPT to complain, as reported by Miles Lane.
this bug was introduced via:
commit 39743c9ef717fd4f2b5583f010115c5f2482b8ae
Author: Andi Kleen <ak@suse.de>
Date: Fri Oct 19 20:35:03 2007 +0200
x86: use raw locks during oopses
- spin_lock_irqsave(&die.lock, flags);
+ __raw_spin_lock(&die.lock);
+ raw_local_save_flags(flags);
that is not a correct open-coding of spin_lock_irqsave(): both the
ordering is wrong (irqs should be disabled _first_), and the wrong
flags-saving API was used.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/traps_32.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index ef6010262597..c88bbffcaa03 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
@@ -373,14 +373,13 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
373 | 373 | ||
374 | if (die.lock_owner != raw_smp_processor_id()) { | 374 | if (die.lock_owner != raw_smp_processor_id()) { |
375 | console_verbose(); | 375 | console_verbose(); |
376 | raw_local_irq_save(flags); | ||
376 | __raw_spin_lock(&die.lock); | 377 | __raw_spin_lock(&die.lock); |
377 | raw_local_save_flags(flags); | ||
378 | die.lock_owner = smp_processor_id(); | 378 | die.lock_owner = smp_processor_id(); |
379 | die.lock_owner_depth = 0; | 379 | die.lock_owner_depth = 0; |
380 | bust_spinlocks(1); | 380 | bust_spinlocks(1); |
381 | } | 381 | } else |
382 | else | 382 | raw_local_irq_save(flags); |
383 | raw_local_save_flags(flags); | ||
384 | 383 | ||
385 | if (++die.lock_owner_depth < 3) { | 384 | if (++die.lock_owner_depth < 3) { |
386 | unsigned long esp; | 385 | unsigned long esp; |