summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/kernel')
-rwxr-xr-xpkg/sentry/kernel/epoll/epoll_state_autogen.go28
-rwxr-xr-xpkg/sentry/kernel/eventfd/eventfd_state_autogen.go4
-rwxr-xr-xpkg/sentry/kernel/futex/futex_state_autogen.go8
-rw-r--r--pkg/sentry/kernel/kernel.go3
-rwxr-xr-xpkg/sentry/kernel/kernel_amd64_state_autogen.go1
-rwxr-xr-xpkg/sentry/kernel/kernel_arm64_state_autogen.go1
-rwxr-xr-xpkg/sentry/kernel/kernel_opts.go20
-rwxr-xr-xpkg/sentry/kernel/kernel_opts_state_autogen.go20
-rwxr-xr-xpkg/sentry/kernel/kernel_state_autogen.go8
-rwxr-xr-xpkg/sentry/kernel/memevent/memevent_state_autogen.go1
-rwxr-xr-xpkg/sentry/kernel/sched/sched_state_autogen.go1
-rwxr-xr-xpkg/sentry/kernel/semaphore/semaphore_state_autogen.go4
12 files changed, 82 insertions, 17 deletions
diff --git a/pkg/sentry/kernel/epoll/epoll_state_autogen.go b/pkg/sentry/kernel/epoll/epoll_state_autogen.go
index c738a9355..68bc33f08 100755
--- a/pkg/sentry/kernel/epoll/epoll_state_autogen.go
+++ b/pkg/sentry/kernel/epoll/epoll_state_autogen.go
@@ -43,13 +43,27 @@ func (x *pollEntry) load(m state.Map) {
func (x *EventPoll) beforeSave() {}
func (x *EventPoll) save(m state.Map) {
x.beforeSave()
- if !state.IsZeroValue(x.FilePipeSeek) { m.Failf("FilePipeSeek is %v, expected zero", x.FilePipeSeek) }
- if !state.IsZeroValue(x.FileNotDirReaddir) { m.Failf("FileNotDirReaddir is %v, expected zero", x.FileNotDirReaddir) }
- if !state.IsZeroValue(x.FileNoFsync) { m.Failf("FileNoFsync is %v, expected zero", x.FileNoFsync) }
- if !state.IsZeroValue(x.FileNoopFlush) { m.Failf("FileNoopFlush is %v, expected zero", x.FileNoopFlush) }
- if !state.IsZeroValue(x.FileNoIoctl) { m.Failf("FileNoIoctl is %v, expected zero", x.FileNoIoctl) }
- if !state.IsZeroValue(x.FileNoMMap) { m.Failf("FileNoMMap is %v, expected zero", x.FileNoMMap) }
- if !state.IsZeroValue(x.Queue) { m.Failf("Queue is %v, expected zero", x.Queue) }
+ if !state.IsZeroValue(x.FilePipeSeek) {
+ m.Failf("FilePipeSeek is %v, expected zero", x.FilePipeSeek)
+ }
+ if !state.IsZeroValue(x.FileNotDirReaddir) {
+ m.Failf("FileNotDirReaddir is %v, expected zero", x.FileNotDirReaddir)
+ }
+ if !state.IsZeroValue(x.FileNoFsync) {
+ m.Failf("FileNoFsync is %v, expected zero", x.FileNoFsync)
+ }
+ if !state.IsZeroValue(x.FileNoopFlush) {
+ m.Failf("FileNoopFlush is %v, expected zero", x.FileNoopFlush)
+ }
+ if !state.IsZeroValue(x.FileNoIoctl) {
+ m.Failf("FileNoIoctl is %v, expected zero", x.FileNoIoctl)
+ }
+ if !state.IsZeroValue(x.FileNoMMap) {
+ m.Failf("FileNoMMap is %v, expected zero", x.FileNoMMap)
+ }
+ if !state.IsZeroValue(x.Queue) {
+ m.Failf("Queue is %v, expected zero", x.Queue)
+ }
m.Save("files", &x.files)
m.Save("readyList", &x.readyList)
m.Save("waitingList", &x.waitingList)
diff --git a/pkg/sentry/kernel/eventfd/eventfd_state_autogen.go b/pkg/sentry/kernel/eventfd/eventfd_state_autogen.go
index f6e94b521..ced262ffc 100755
--- a/pkg/sentry/kernel/eventfd/eventfd_state_autogen.go
+++ b/pkg/sentry/kernel/eventfd/eventfd_state_autogen.go
@@ -9,7 +9,9 @@ import (
func (x *EventOperations) beforeSave() {}
func (x *EventOperations) save(m state.Map) {
x.beforeSave()
- if !state.IsZeroValue(x.wq) { m.Failf("wq is %v, expected zero", x.wq) }
+ if !state.IsZeroValue(x.wq) {
+ m.Failf("wq is %v, expected zero", x.wq)
+ }
m.Save("val", &x.val)
m.Save("semMode", &x.semMode)
m.Save("hostfd", &x.hostfd)
diff --git a/pkg/sentry/kernel/futex/futex_state_autogen.go b/pkg/sentry/kernel/futex/futex_state_autogen.go
index b2ff39f17..e96b86d1c 100755
--- a/pkg/sentry/kernel/futex/futex_state_autogen.go
+++ b/pkg/sentry/kernel/futex/futex_state_autogen.go
@@ -21,7 +21,9 @@ func (x *AtomicPtrBucket) load(m state.Map) {
func (x *bucket) beforeSave() {}
func (x *bucket) save(m state.Map) {
x.beforeSave()
- if !state.IsZeroValue(x.waiters) { m.Failf("waiters is %v, expected zero", x.waiters) }
+ if !state.IsZeroValue(x.waiters) {
+ m.Failf("waiters is %v, expected zero", x.waiters)
+ }
}
func (x *bucket) afterLoad() {}
@@ -31,7 +33,9 @@ func (x *bucket) load(m state.Map) {
func (x *Manager) beforeSave() {}
func (x *Manager) save(m state.Map) {
x.beforeSave()
- if !state.IsZeroValue(x.privateBuckets) { m.Failf("privateBuckets is %v, expected zero", x.privateBuckets) }
+ if !state.IsZeroValue(x.privateBuckets) {
+ m.Failf("privateBuckets is %v, expected zero", x.privateBuckets)
+ }
m.Save("sharedBucket", &x.sharedBucket)
}
diff --git a/pkg/sentry/kernel/kernel.go b/pkg/sentry/kernel/kernel.go
index dcd6e91c4..3ee760ba2 100644
--- a/pkg/sentry/kernel/kernel.go
+++ b/pkg/sentry/kernel/kernel.go
@@ -235,6 +235,9 @@ type Kernel struct {
// events. This is initialized lazily on the first unimplemented
// syscall.
unimplementedSyscallEmitter eventchannel.Emitter `state:"nosave"`
+
+ // SpecialOpts contains special kernel options.
+ SpecialOpts
}
// InitKernelArgs holds arguments to Init.
diff --git a/pkg/sentry/kernel/kernel_amd64_state_autogen.go b/pkg/sentry/kernel/kernel_amd64_state_autogen.go
index 236e69666..12de47ad0 100755
--- a/pkg/sentry/kernel/kernel_amd64_state_autogen.go
+++ b/pkg/sentry/kernel/kernel_amd64_state_autogen.go
@@ -3,4 +3,3 @@
// +build amd64
package kernel
-
diff --git a/pkg/sentry/kernel/kernel_arm64_state_autogen.go b/pkg/sentry/kernel/kernel_arm64_state_autogen.go
index 2900fe048..3c040d283 100755
--- a/pkg/sentry/kernel/kernel_arm64_state_autogen.go
+++ b/pkg/sentry/kernel/kernel_arm64_state_autogen.go
@@ -3,4 +3,3 @@
// +build arm64
package kernel
-
diff --git a/pkg/sentry/kernel/kernel_opts.go b/pkg/sentry/kernel/kernel_opts.go
new file mode 100755
index 000000000..2e66ec587
--- /dev/null
+++ b/pkg/sentry/kernel/kernel_opts.go
@@ -0,0 +1,20 @@
+// Copyright 2020 The gVisor Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package kernel
+
+// SpecialOpts contains non-standard options for the kernel.
+//
+// +stateify savable
+type SpecialOpts struct{}
diff --git a/pkg/sentry/kernel/kernel_opts_state_autogen.go b/pkg/sentry/kernel/kernel_opts_state_autogen.go
new file mode 100755
index 000000000..88a3f1072
--- /dev/null
+++ b/pkg/sentry/kernel/kernel_opts_state_autogen.go
@@ -0,0 +1,20 @@
+// automatically generated by stateify.
+
+package kernel
+
+import (
+ "gvisor.dev/gvisor/pkg/state"
+)
+
+func (x *SpecialOpts) beforeSave() {}
+func (x *SpecialOpts) save(m state.Map) {
+ x.beforeSave()
+}
+
+func (x *SpecialOpts) afterLoad() {}
+func (x *SpecialOpts) load(m state.Map) {
+}
+
+func init() {
+ state.Register("kernel.SpecialOpts", (*SpecialOpts)(nil), state.Fns{Save: (*SpecialOpts).save, Load: (*SpecialOpts).load})
+}
diff --git a/pkg/sentry/kernel/kernel_state_autogen.go b/pkg/sentry/kernel/kernel_state_autogen.go
index 0aa106128..ea97733a9 100755
--- a/pkg/sentry/kernel/kernel_state_autogen.go
+++ b/pkg/sentry/kernel/kernel_state_autogen.go
@@ -3,9 +3,9 @@
package kernel
import (
- "gvisor.dev/gvisor/pkg/state"
"gvisor.dev/gvisor/pkg/bpf"
"gvisor.dev/gvisor/pkg/sentry/device"
+ "gvisor.dev/gvisor/pkg/state"
"gvisor.dev/gvisor/pkg/tcpip"
)
@@ -151,6 +151,7 @@ func (x *Kernel) save(m state.Map) {
m.Save("sockets", &x.sockets)
m.Save("nextSocketEntry", &x.nextSocketEntry)
m.Save("DirentCacheLimiter", &x.DirentCacheLimiter)
+ m.Save("SpecialOpts", &x.SpecialOpts)
}
func (x *Kernel) afterLoad() {}
@@ -182,6 +183,7 @@ func (x *Kernel) load(m state.Map) {
m.Load("sockets", &x.sockets)
m.Load("nextSocketEntry", &x.nextSocketEntry)
m.Load("DirentCacheLimiter", &x.DirentCacheLimiter)
+ m.Load("SpecialOpts", &x.SpecialOpts)
m.LoadValue("danglingEndpoints", new([]tcpip.Endpoint), func(y interface{}) { x.loadDanglingEndpoints(y.([]tcpip.Endpoint)) })
m.LoadValue("deviceRegistry", new(*device.Registry), func(y interface{}) { x.loadDeviceRegistry(y.(*device.Registry)) })
}
@@ -522,7 +524,9 @@ func (x *syslog) load(m state.Map) {
func (x *Task) beforeSave() {}
func (x *Task) save(m state.Map) {
x.beforeSave()
- if !state.IsZeroValue(x.signalQueue) { m.Failf("signalQueue is %v, expected zero", x.signalQueue) }
+ if !state.IsZeroValue(x.signalQueue) {
+ m.Failf("signalQueue is %v, expected zero", x.signalQueue)
+ }
var ptraceTracer *Task = x.savePtraceTracer()
m.SaveValue("ptraceTracer", ptraceTracer)
var syscallFilters []bpf.Program = x.saveSyscallFilters()
diff --git a/pkg/sentry/kernel/memevent/memevent_state_autogen.go b/pkg/sentry/kernel/memevent/memevent_state_autogen.go
index 8bfbba80f..4a1679fa9 100755
--- a/pkg/sentry/kernel/memevent/memevent_state_autogen.go
+++ b/pkg/sentry/kernel/memevent/memevent_state_autogen.go
@@ -1,4 +1,3 @@
// automatically generated by stateify.
package memevent
-
diff --git a/pkg/sentry/kernel/sched/sched_state_autogen.go b/pkg/sentry/kernel/sched/sched_state_autogen.go
index 2a482732e..9705ca79d 100755
--- a/pkg/sentry/kernel/sched/sched_state_autogen.go
+++ b/pkg/sentry/kernel/sched/sched_state_autogen.go
@@ -1,4 +1,3 @@
// automatically generated by stateify.
package sched
-
diff --git a/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go b/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go
index f225f6f75..d53d67f74 100755
--- a/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go
+++ b/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go
@@ -53,7 +53,9 @@ func (x *Set) load(m state.Map) {
func (x *sem) beforeSave() {}
func (x *sem) save(m state.Map) {
x.beforeSave()
- if !state.IsZeroValue(x.waiters) { m.Failf("waiters is %v, expected zero", x.waiters) }
+ if !state.IsZeroValue(x.waiters) {
+ m.Failf("waiters is %v, expected zero", x.waiters)
+ }
m.Save("value", &x.value)
m.Save("pid", &x.pid)
}