fix do_wait(!__WALL) hang (Was: mmotm 2009-08-24-16-24 uploaded)
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | do_wait-wakeup-optimization: fix child_wait_callback()->eligible_child() usagekernel/ | +9 | 1 reply | |
| 2/2 | do_wait-wakeup-optimization: simplify task_pid_type()kernel/ | +6 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by.
| Patch | KAMEZAWA Hiroyuki |
|---|---|
| 1/2 | T-b |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH -mm 0/2] fix do_wait(!__WALL) hang (Was: mmotm 2009-08-24-16-24 uploaded)
Quoted 20 lines · Roland McGrath
Quoted 13 lines
eligible_child:/* Wait for all children (clone and not) if __WALL is set; * otherwise, wait for clone children *only* if __WCLONE is * set; otherwise, wait for non-clone children *only*. (Note: * A "clone" child here is one that reports to its parent * using a signal other than SIGCHLD.) */ if (((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE)) && !(wo->wo_flags & __WALL)) return 0;Quoted 2 lines
I just can't understand what is the supposed behaviour when p is sub-thread and
p->exit_signal== -1.As you say, you're not even supposed to be here when
exit_signal= -1, except for the ptrace case. This logic exists for the non-CLONE_THREAD clone case, i.e. ->exit_signal != SIGCHLD and != -1.
Quoted 7 lines
Quoted 5 lines
IOW, perhaps this check should be
if (!task_detached(p) && !(wo->wo_flags & __WALL) && (p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE)) return 0;That seems OK to me.
And this looks more right...
Quoted 7 lines
Quoted 2 lines
In short. If ptracer calls
wait4(ptraced_sub_thread), is it really supposed it must use__WCLONE||__WALL?I suspect not, but I'm not quite sure. That is, it makes sense to me that a ptracer should always get its tracees in all waits. That is consistent with not having to use WUNTRACED, for example. But I'm not really sure any more what the historical behavior of this has been.
Yes. Let's not change this code. This is user-visible, might break something. I think it is better to make more "safe" fix.
Oleg.