kernel: Panic on attempts to block a pinned thread.

Preventing "normal" context switches caused by a time interrupt
is the primary reason for pinning threads. "thread_block" and friends,
however, cause an explicit context switch and will not return until
another thread unblocks us.

Calling these while a thread is pinned is thus undefined behavior,
and so we should just panic in the case anyone attempts to do so.
This commit is contained in:
Augustin Cavalier
2019-02-19 21:35:39 -05:00
parent a21f7b525b
commit 58ed2965d0
+5
View File
@@ -2847,6 +2847,11 @@ thread_block_timeout(timer* timer)
static inline status_t
thread_block_locked(Thread* thread)
{
if (thread->pinned_to_cpu > 0) {
panic("attempting to block thread %" B_PRId32 ", which is pinned!",
thread->id);
}
if (thread->wait.status == 1) {
// check for signals, if interruptible
if (thread_is_interrupted(thread, thread->wait.flags)) {