summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/g3doc/run_states.dot
diff options
context:
space:
mode:
authorGoogler <noreply@google.com>2018-04-27 10:37:02 -0700
committerAdin Scannell <ascannell@google.com>2018-04-28 01:44:26 -0400
commitd02b74a5dcfed4bfc8f2f8e545bca4d2afabb296 (patch)
tree54f95eef73aee6bacbfc736fffc631be2605ed53 /pkg/sentry/kernel/g3doc/run_states.dot
parentf70210e742919f40aa2f0934a22f1c9ba6dada62 (diff)
Check in gVisor.
PiperOrigin-RevId: 194583126 Change-Id: Ica1d8821a90f74e7e745962d71801c598c652463
Diffstat (limited to 'pkg/sentry/kernel/g3doc/run_states.dot')
-rw-r--r--pkg/sentry/kernel/g3doc/run_states.dot99
1 files changed, 99 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/g3doc/run_states.dot b/pkg/sentry/kernel/g3doc/run_states.dot
new file mode 100644
index 000000000..7861fe1f5
--- /dev/null
+++ b/pkg/sentry/kernel/g3doc/run_states.dot
@@ -0,0 +1,99 @@
+digraph {
+ subgraph {
+ App;
+ }
+ subgraph {
+ Interrupt;
+ InterruptAfterSignalDeliveryStop;
+ }
+ subgraph {
+ Syscall;
+ SyscallAfterPtraceEventSeccomp;
+ SyscallEnter;
+ SyscallAfterSyscallEnterStop;
+ SyscallAfterSysemuStop;
+ SyscallInvoke;
+ SyscallAfterPtraceEventClone;
+ SyscallAfterExecStop;
+ SyscallAfterVforkStop;
+ SyscallReinvoke;
+ SyscallExit;
+ }
+ subgraph {
+ Vsyscall;
+ VsyscallAfterPtraceEventSeccomp;
+ VsyscallInvoke;
+ }
+ subgraph {
+ Exit;
+ ExitMain; // leave thread group, release resources, reparent children, kill PID namespace and wait if TGID 1
+ ExitNotify; // signal parent/tracer, become waitable
+ ExitDone; // represented by t.runState == nil
+ }
+
+ // Task exit
+ Exit -> ExitMain;
+ ExitMain -> ExitNotify;
+ ExitNotify -> ExitDone;
+
+ // Execution of untrusted application code
+ App -> App;
+
+ // Interrupts (usually signal delivery)
+ App -> Interrupt;
+ Interrupt -> Interrupt; // if other interrupt conditions may still apply
+ Interrupt -> Exit; // if killed
+
+ // Syscalls
+ App -> Syscall;
+ Syscall -> SyscallEnter;
+ SyscallEnter -> SyscallInvoke;
+ SyscallInvoke -> SyscallExit;
+ SyscallExit -> App;
+
+ // exit, exit_group
+ SyscallInvoke -> Exit;
+
+ // execve
+ SyscallInvoke -> SyscallAfterExecStop;
+ SyscallAfterExecStop -> SyscallExit;
+ SyscallAfterExecStop -> App; // fatal signal pending
+
+ // vfork
+ SyscallInvoke -> SyscallAfterVforkStop;
+ SyscallAfterVforkStop -> SyscallExit;
+
+ // Vsyscalls
+ App -> Vsyscall;
+ Vsyscall -> VsyscallInvoke;
+ Vsyscall -> App; // fault while reading return address from stack
+ VsyscallInvoke -> App;
+
+ // ptrace-specific branches
+ Interrupt -> InterruptAfterSignalDeliveryStop;
+ InterruptAfterSignalDeliveryStop -> Interrupt;
+ SyscallEnter -> SyscallAfterSyscallEnterStop;
+ SyscallAfterSyscallEnterStop -> SyscallInvoke;
+ SyscallAfterSyscallEnterStop -> SyscallExit; // skipped by tracer
+ SyscallAfterSyscallEnterStop -> App; // fatal signal pending
+ SyscallEnter -> SyscallAfterSysemuStop;
+ SyscallAfterSysemuStop -> SyscallExit;
+ SyscallAfterSysemuStop -> App; // fatal signal pending
+ SyscallInvoke -> SyscallAfterPtraceEventClone;
+ SyscallAfterPtraceEventClone -> SyscallExit;
+ SyscallAfterPtraceEventClone -> SyscallAfterVforkStop;
+
+ // seccomp
+ Syscall -> App; // SECCOMP_RET_TRAP, SECCOMP_RET_ERRNO, SECCOMP_RET_KILL, SECCOMP_RET_TRACE without tracer
+ Syscall -> SyscallAfterPtraceEventSeccomp; // SECCOMP_RET_TRACE
+ SyscallAfterPtraceEventSeccomp -> SyscallEnter;
+ SyscallAfterPtraceEventSeccomp -> SyscallExit; // skipped by tracer
+ SyscallAfterPtraceEventSeccomp -> App; // fatal signal pending
+ Vsyscall -> VsyscallAfterPtraceEventSeccomp;
+ VsyscallAfterPtraceEventSeccomp -> VsyscallInvoke;
+ VsyscallAfterPtraceEventSeccomp -> App;
+
+ // Autosave
+ SyscallInvoke -> SyscallReinvoke;
+ SyscallReinvoke -> SyscallInvoke;
+}