From f68892b93ebd8bd0f05cac6ed20e21ffdf6e8719 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 19 Mar 2009 13:57:10 +0000 Subject: [PATCH] deliver_signal() SIGKILL: * Use atomic_or() to update sig_pending of the main thread. * We didn't call update_thread_signals_flag() for the main thread, so its handle_signals() wouldn't be called, resulting in an infinite loop, if this signal interrupted a restartable syscall. Calling exit() from another thread than the main thread was likely to run into this problem. Should fix #3178. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29612 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/signal.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/signal.cpp b/src/system/kernel/signal.cpp index 7a8b8617ae..5007826043 100644 --- a/src/system/kernel/signal.cpp +++ b/src/system/kernel/signal.cpp @@ -505,16 +505,18 @@ deliver_signal(struct thread *thread, uint signal, uint32 flags) switch (signal) { case SIGKILL: { - struct thread *mainThread = thread->team->main_thread; // Forward KILLTHR to the main thread of the team + struct thread *mainThread = thread->team->main_thread; + atomic_or(&mainThread->sig_pending, SIGNAL_TO_MASK(SIGKILLTHR)); - mainThread->sig_pending |= SIGNAL_TO_MASK(SIGKILLTHR); // Wake up main thread if (mainThread->state == B_THREAD_SUSPENDED) scheduler_enqueue_in_run_queue(mainThread); else thread_interrupt(mainThread, true); + update_thread_signals_flag(mainThread); + // Supposed to fall through } case SIGKILLTHR: