From c054900882e6dcc20f8fe2ff4fd9e605613923cf Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sun, 17 Feb 2019 14:36:16 -0500 Subject: [PATCH] kernel: Sanity-check interrupts in snooze(). This didn't trigger any panics on my bare-metal dev install when tested, but it might explain some easily-reproducible hardlocks (i.e. can't even drop to KDL via emergency keys) I was seeing on other machines. --- src/system/kernel/thread.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/system/kernel/thread.cpp b/src/system/kernel/thread.cpp index 073bbaa58a..1315338f1c 100644 --- a/src/system/kernel/thread.cpp +++ b/src/system/kernel/thread.cpp @@ -1373,6 +1373,13 @@ static status_t common_snooze_etc(bigtime_t timeout, clockid_t clockID, uint32 flags, bigtime_t* _remainingTime) { +#if KDEBUG + if (!are_interrupts_enabled()) { + panic("common_snooze_etc(): called with interrupts disabled, timeout " + "%" B_PRIdBIGTIME, timeout); + } +#endif + switch (clockID) { case CLOCK_REALTIME: // make sure the B_TIMEOUT_REAL_TIME_BASE flag is set and fall