Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177949226
D61987.1795627585.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61987.1795627585.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 25, 5:26 PM (23 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41992575
Default Alt Text
D61987.1795627585.diff (1 KB)
Attached To
Mode
D61987: LinuxKPI: Report pending signal when process is exiting
Attached
Detach File
Event Timeline