Page MenuHomeFreeBSD

D61987.1795625738.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D61987.1795625738.diff

diff --git a/sys/compat/linuxkpi/common/src/linux_schedule.c b/sys/compat/linuxkpi/common/src/linux_schedule.c
--- a/sys/compat/linuxkpi/common/src/linux_schedule.c
+++ b/sys/compat/linuxkpi/common/src/linux_schedule.c
@@ -129,6 +129,19 @@
return (ret);
}
+/* Process is exiting (or exec'ing) and td is not the thread doing it. */
+static bool
+linux_proc_exiting(struct thread *td)
+{
+ struct proc *p = td->td_proc;
+
+ PROC_LOCK_ASSERT(p, MA_OWNED);
+ if ((p->p_flag & P_WEXIT) != 0 && p->p_singlethread != td)
+ return (true);
+ return ((p->p_flag & P_SINGLE_EXIT) != 0 &&
+ p->p_singlethread != td);
+}
+
bool
linux_signal_pending(struct task_struct *task)
{
@@ -137,6 +150,15 @@
td = task->task_thread;
PROC_LOCK(td->td_proc);
+ /*
+ * Linux delivers SIGKILL to all other threads on exit; FreeBSD
+ * single-threads the process instead. Report a pending signal so
+ * that LinuxKPI wait loops bail out and let thread_single() finish.
+ */
+ if (linux_proc_exiting(td)) {
+ PROC_UNLOCK(td->td_proc);
+ return (true);
+ }
pending = td->td_siglist;
SIGSETOR(pending, td->td_proc->p_siglist);
SIGSETNAND(pending, td->td_sigmask);
@@ -153,7 +175,8 @@
td = task->task_thread;
PROC_LOCK(td->td_proc);
ret = SIGISMEMBER(td->td_siglist, SIGKILL) ||
- SIGISMEMBER(td->td_proc->p_siglist, SIGKILL);
+ SIGISMEMBER(td->td_proc->p_siglist, SIGKILL) ||
+ linux_proc_exiting(td);
PROC_UNLOCK(td->td_proc);
return (ret);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 25, 4:55 PM (23 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41992575
Default Alt Text
D61987.1795625738.diff (1 KB)

Event Timeline