diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-04-23 00:54:53 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-23 00:54:53 +0000 |
commit | 51a2b731236faedefa999f6d7ff158cfbe0fba8b (patch) | |
tree | f3944419852a767526666d1d9f1e2189a9f212e3 /pkg/sentry/platform/platform.go | |
parent | dd8e417e4265c358fd603a57cc03bb4902116ecf (diff) | |
parent | 0c586946ea26610b87c4ff7bda783a5a9ca11ec0 (diff) |
Merge release-20200323.0-215-g0c58694 (automated)
Diffstat (limited to 'pkg/sentry/platform/platform.go')
-rw-r--r-- | pkg/sentry/platform/platform.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/sentry/platform/platform.go b/pkg/sentry/platform/platform.go index 2ca696382..171513f3f 100644 --- a/pkg/sentry/platform/platform.go +++ b/pkg/sentry/platform/platform.go @@ -148,6 +148,9 @@ type Context interface { // Interrupt interrupts a concurrent call to Switch(), causing it to return // ErrContextInterrupt. Interrupt() + + // Release() releases any resources associated with this context. + Release() } var ( @@ -353,10 +356,28 @@ func (fr FileRange) String() string { return fmt.Sprintf("[%#x, %#x)", fr.Start, fr.End) } +// Requirements is used to specify platform specific requirements. +type Requirements struct { + // RequiresCurrentPIDNS indicates that the sandbox has to be started in the + // current pid namespace. + RequiresCurrentPIDNS bool + // RequiresCapSysPtrace indicates that the sandbox has to be started with + // the CAP_SYS_PTRACE capability. + RequiresCapSysPtrace bool +} + // Constructor represents a platform type. type Constructor interface { + // New returns a new platform instance. + // + // Arguments: + // + // * deviceFile - the device file (e.g. /dev/kvm for the KVM platform). New(deviceFile *os.File) (Platform, error) OpenDevice() (*os.File, error) + + // Requirements returns platform specific requirements. + Requirements() Requirements } // platforms contains all available platform types. |