[patch] wait4-fix-2.5.34-A0, BK-curr

From: Ingo Molnar (mingo@elte.hu)
Date: Sun Sep 15 2002 - 02:39:26 EST


the attached patch (against BK-curr) fixes a sys_wait4() bug noticed by
Ulrich Drepper. The kernel would not block properly if there are eligible
children delayed due to the new delayed thread-group-leader logic. The
solution is to introduce a new type of 'eligible child' type - and skip
over delayed children but set the wait4 flag nevertheless.

The libpthreads testcase that failed due to it now it works fine.

        Ingo

--- linux/kernel/exit.c.orig Sun Sep 15 09:29:51 2002
+++ linux/kernel/exit.c Sun Sep 15 09:26:42 2002
@@ -731,7 +731,7 @@
          * in a non-empty thread group:
          */
         if (current->tgid != p->tgid && delay_group_leader(p))
- return 0;
+ return 2;
 
         if (security_ops->task_wait(p))
                 return 0;
@@ -757,11 +757,21 @@
         do {
                 struct task_struct *p;
                 struct list_head *_p;
+ int ret;
+
                 list_for_each(_p,&tsk->children) {
                         p = list_entry(_p,struct task_struct,sibling);
- if (!eligible_child(pid, options, p))
+
+ ret = eligible_child(pid, options, p);
+ if (!ret)
                                 continue;
                         flag = 1;
+ /*
+ * Eligible but we cannot release it yet:
+ */
+ if (ret == 2)
+ continue;
+
                         switch (p->state) {
                         case TASK_STOPPED:
                                 if (!p->exit_code)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 15 2002 - 22:00:37 EST