diff options
author | Jamie Liu <jamieliu@google.com> | 2019-03-22 08:54:30 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-03-22 08:55:44 -0700 |
commit | 3d0b960112c94379e4974fd9b60d4632548a4389 (patch) | |
tree | cd388d52ad38421408c8aa05d20ec5703a997128 /pkg/sentry/kernel/thread_group.go | |
parent | 45ba52f8246a7060da48e250512a734a79187adf (diff) |
Implement PTRACE_SEIZE, PTRACE_INTERRUPT, and PTRACE_LISTEN.
PiperOrigin-RevId: 239803092
Change-Id: I42d612ed6a889e011e8474538958c6de90c6fcab
Diffstat (limited to 'pkg/sentry/kernel/thread_group.go')
-rw-r--r-- | pkg/sentry/kernel/thread_group.go | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/pkg/sentry/kernel/thread_group.go b/pkg/sentry/kernel/thread_group.go index d7652f57c..1b7b74319 100644 --- a/pkg/sentry/kernel/thread_group.go +++ b/pkg/sentry/kernel/thread_group.go @@ -60,25 +60,35 @@ type ThreadGroup struct { // pendingSignals is protected by the signal mutex. pendingSignals pendingSignals - // groupStopPhase indicates the state of a group stop in progress on the - // thread group, if any. + // If groupStopDequeued is true, a task in the thread group has dequeued a + // stop signal, but has not yet initiated the group stop. // - // groupStopPhase is protected by the signal mutex. - groupStopPhase groupStopPhase + // groupStopDequeued is analogous to Linux's JOBCTL_STOP_DEQUEUED. + // + // groupStopDequeued is protected by the signal mutex. + groupStopDequeued bool // groupStopSignal is the signal that caused a group stop to be initiated. - // groupStopSignal is only meaningful if groupStopPhase is - // groupStopInitiated or groupStopComplete. // // groupStopSignal is protected by the signal mutex. groupStopSignal linux.Signal - // groupStopCount is the number of non-exited tasks in the thread group - // that have acknowledged an initiated group stop. groupStopCount is only - // meaningful if groupStopPhase is groupStopInitiated. + // groupStopPendingCount is the number of active tasks in the thread group + // for which Task.groupStopPending is set. + // + // groupStopPendingCount is analogous to Linux's + // signal_struct::group_stop_count. // - // groupStopCount is protected by the signal mutex. - groupStopCount int + // groupStopPendingCount is protected by the signal mutex. + groupStopPendingCount int + + // If groupStopComplete is true, groupStopPendingCount transitioned from + // non-zero to zero without an intervening SIGCONT. + // + // groupStopComplete is analogous to Linux's SIGNAL_STOP_STOPPED. + // + // groupStopComplete is protected by the signal mutex. + groupStopComplete bool // If groupStopWaitable is true, the thread group is indicating a waitable // group stop event (as defined by EventChildGroupStop). @@ -91,14 +101,9 @@ type ThreadGroup struct { // If groupContNotify is true, then a SIGCONT has recently ended a group // stop on this thread group, and the first task to observe it should - // notify its parent. - // - // groupContNotify is protected by the signal mutex. - groupContNotify bool - - // If groupContNotify is true, groupContInterrupted is true iff SIGCONT - // ended a group stop in phase groupStopInitiated. If groupContNotify is - // false, groupContInterrupted is meaningless. + // notify its parent. groupContInterrupted is true iff SIGCONT ended an + // incomplete group stop. If groupContNotify is false, groupContInterrupted is + // meaningless. // // Analogues in Linux: // @@ -110,7 +115,9 @@ type ThreadGroup struct { // // - !groupContNotify is represented by neither flag being set. // - // groupContInterrupted is protected by the signal mutex. + // groupContNotify and groupContInterrupted are protected by the signal + // mutex. + groupContNotify bool groupContInterrupted bool // If groupContWaitable is true, the thread group is indicating a waitable |