aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQiao Zhou <qiaozhou@asrmicro.com>2017-07-07 05:29:34 -0400
committerWill Deacon <will.deacon@arm.com>2017-07-20 05:21:06 -0400
commit6f44a0bacb79a03972c83759711832b382b1b8ac (patch)
tree1b27e981920b688e44df86722d3903e6e93cdc5b
parent32fb5d73c98b079e7c815b62e9d88a39ff8ce509 (diff)
arm64: traps: disable irq in die()
In current die(), the irq is disabled for __die() handle, not including the possible panic() handling. Since the log in __die() can take several hundreds ms, new irq might come and interrupt current die(). If the process calling die() holds some critical resource, and some other process scheduled later also needs it, then it would deadlock. The first panic will not be executed. So here disable irq for the whole flow of die(). Signed-off-by: Qiao Zhou <qiaozhou@asrmicro.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--arch/arm64/kernel/traps.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index c7c7088097be..d48f47080213 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -274,10 +274,12 @@ static DEFINE_RAW_SPINLOCK(die_lock);
274void die(const char *str, struct pt_regs *regs, int err) 274void die(const char *str, struct pt_regs *regs, int err)
275{ 275{
276 int ret; 276 int ret;
277 unsigned long flags;
278
279 raw_spin_lock_irqsave(&die_lock, flags);
277 280
278 oops_enter(); 281 oops_enter();
279 282
280 raw_spin_lock_irq(&die_lock);
281 console_verbose(); 283 console_verbose();
282 bust_spinlocks(1); 284 bust_spinlocks(1);
283 ret = __die(str, err, regs); 285 ret = __die(str, err, regs);
@@ -287,13 +289,15 @@ void die(const char *str, struct pt_regs *regs, int err)
287 289
288 bust_spinlocks(0); 290 bust_spinlocks(0);
289 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); 291 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
290 raw_spin_unlock_irq(&die_lock);
291 oops_exit(); 292 oops_exit();
292 293
293 if (in_interrupt()) 294 if (in_interrupt())
294 panic("Fatal exception in interrupt"); 295 panic("Fatal exception in interrupt");
295 if (panic_on_oops) 296 if (panic_on_oops)
296 panic("Fatal exception"); 297 panic("Fatal exception");
298
299 raw_spin_unlock_irqrestore(&die_lock, flags);
300
297 if (ret != NOTIFY_STOP) 301 if (ret != NOTIFY_STOP)
298 do_exit(SIGSEGV); 302 do_exit(SIGSEGV);
299} 303}