diff options
author | Michael Pratt <mpratt@google.com> | 2019-05-28 18:02:07 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-05-30 12:05:46 -0700 |
commit | 507a15dce974d0cff18253ba50af29d6579bacc5 (patch) | |
tree | c4b67eab0208a8b3b9417f516dcc6661441337f0 /pkg/sentry/kernel | |
parent | 673358c0d94f82ac56d9f4f6e7aec7ff5761e1cc (diff) |
Always wait on tracee children
After bf959931ddb88c4e4366e96dd22e68fa0db9527c ("wait/ptrace: assume
__WALL if the child is traced") (Linux 4.7), tracees are always eligible
for waiting, regardless of type.
PiperOrigin-RevId: 250399527
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r-- | pkg/sentry/kernel/task_exit.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/sentry/kernel/task_exit.go b/pkg/sentry/kernel/task_exit.go index 2e1e46582..158e665d3 100644 --- a/pkg/sentry/kernel/task_exit.go +++ b/pkg/sentry/kernel/task_exit.go @@ -803,13 +803,17 @@ type WaitOptions struct { } // Preconditions: The TaskSet mutex must be locked (for reading or writing). -func (o *WaitOptions) matchesTask(t *Task, pidns *PIDNamespace) bool { +func (o *WaitOptions) matchesTask(t *Task, pidns *PIDNamespace, tracee bool) bool { if o.SpecificTID != 0 && o.SpecificTID != pidns.tids[t] { return false } if o.SpecificPGID != 0 && o.SpecificPGID != pidns.pgids[t.tg.processGroup] { return false } + // Tracees are always eligible. + if tracee { + return true + } if t == t.tg.leader && t.tg.terminationSignal == linux.SIGCHLD { return o.NonCloneTasks } @@ -903,7 +907,7 @@ func (t *Task) waitParentLocked(opts *WaitOptions, parent *Task) (*WaitResult, b anyWaitableTasks := false for child := range parent.children { - if !opts.matchesTask(child, parent.tg.pidns) { + if !opts.matchesTask(child, parent.tg.pidns, false) { continue } // Non-leaders don't notify parents on exit and aren't eligible to @@ -946,7 +950,7 @@ func (t *Task) waitParentLocked(opts *WaitOptions, parent *Task) (*WaitResult, b } } for tracee := range parent.ptraceTracees { - if !opts.matchesTask(tracee, parent.tg.pidns) { + if !opts.matchesTask(tracee, parent.tg.pidns, true) { continue } // Non-leaders do notify tracers on exit. |