summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSergio López <slpml@sinrega.org>2011-09-27 15:52:51 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2011-09-28 01:12:57 +0200
commit0a55db5302a78ea51a1b4e4ff3ba632f34b2f6af (patch)
treeff740e3615038781b049caa2ffc05386f4cfeff4 /kern
parentec76bb9b04b851f403fac72fddaa8613025c7da4 (diff)
Make thread_suspend honor the TH_UNINT flag
Interrupting a thread without a continuation, puts it in a inconsistent state. This is the cause for the bug described in https://lists.gnu.org/archive/html/bug-hurd/2011-09/msg00148.html * kern/thread.c (thread_suspend): Fail with KERN_FAILURE if thread is uninterruptible.
Diffstat (limited to 'kern')
-rw-r--r--kern/thread.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kern/thread.c b/kern/thread.c
index 1548e14..bf2df94 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1329,6 +1329,11 @@ kern_return_t thread_suspend(
hold = FALSE;
spl = splsched();
thread_lock(thread);
+ if (thread->state & TH_UNINT) {
+ thread_unlock(thread);
+ (void) splx(spl);
+ return KERN_FAILURE;
+ }
if (thread->user_stop_count++ == 0) {
hold = TRUE;
thread->suspend_count++;