diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-02-06 06:49:12 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-02-06 06:49:12 +0000 |
commit | 971856a97882eee6fc216b12e8e20bba0f14c231 (patch) | |
tree | 9a71fe33a8c62ffd2bfa29bc27d59722b9412f60 /pkg | |
parent | b3a9b1da3837ba2636e621467bb56aad942caf5c (diff) | |
parent | 1b6a12a768216a99a5e0428c42ea4faf79cf3b50 (diff) |
Merge release-20200127.0-85-g1b6a12a (automated)
Diffstat (limited to 'pkg')
141 files changed, 393 insertions, 356 deletions
diff --git a/pkg/abi/abi_linux_state_autogen.go b/pkg/abi/abi_linux_state_autogen.go index 568ce4214..327ef0e5c 100755 --- a/pkg/abi/abi_linux_state_autogen.go +++ b/pkg/abi/abi_linux_state_autogen.go @@ -3,4 +3,3 @@ // +build linux package abi - diff --git a/pkg/abi/abi_state_autogen.go b/pkg/abi/abi_state_autogen.go index 4f94570e5..d54002c3b 100755 --- a/pkg/abi/abi_state_autogen.go +++ b/pkg/abi/abi_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package abi - diff --git a/pkg/abi/linux/linux_amd64_state_autogen.go b/pkg/abi/linux/linux_amd64_state_autogen.go index 5e3c1ae4a..bddf5a794 100755 --- a/pkg/abi/linux/linux_amd64_state_autogen.go +++ b/pkg/abi/linux/linux_amd64_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package linux - diff --git a/pkg/abi/linux/linux_arm64_state_autogen.go b/pkg/abi/linux/linux_arm64_state_autogen.go index 5e3c1ae4a..bddf5a794 100755 --- a/pkg/abi/linux/linux_arm64_state_autogen.go +++ b/pkg/abi/linux/linux_arm64_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package linux - diff --git a/pkg/amutex/amutex_state_autogen.go b/pkg/amutex/amutex_state_autogen.go index 5651ae4e9..5a09c71ed 100755 --- a/pkg/amutex/amutex_state_autogen.go +++ b/pkg/amutex/amutex_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package amutex - diff --git a/pkg/atomicbitops/atomicbitops_state_autogen.go b/pkg/atomicbitops/atomicbitops_state_autogen.go index 1164483bd..06fcf712a 100755 --- a/pkg/atomicbitops/atomicbitops_state_autogen.go +++ b/pkg/atomicbitops/atomicbitops_state_autogen.go @@ -4,4 +4,3 @@ // +build !amd64,!arm64 package atomicbitops - diff --git a/pkg/binary/binary_state_autogen.go b/pkg/binary/binary_state_autogen.go index e29aeb344..4661a5982 100755 --- a/pkg/binary/binary_state_autogen.go +++ b/pkg/binary/binary_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package binary - diff --git a/pkg/bits/bits_state_autogen.go b/pkg/bits/bits_state_autogen.go index fe573eeaa..22b8250c6 100755 --- a/pkg/bits/bits_state_autogen.go +++ b/pkg/bits/bits_state_autogen.go @@ -4,4 +4,3 @@ // +build !amd64,!arm64 package bits - diff --git a/pkg/compressio/compressio_state_autogen.go b/pkg/compressio/compressio_state_autogen.go index cac5ea41c..c47e0dd17 100755 --- a/pkg/compressio/compressio_state_autogen.go +++ b/pkg/compressio/compressio_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package compressio - diff --git a/pkg/context/context_state_autogen.go b/pkg/context/context_state_autogen.go index 7dd55bfea..fdc3c9fbb 100755 --- a/pkg/context/context_state_autogen.go +++ b/pkg/context/context_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package context - diff --git a/pkg/control/client/client_state_autogen.go b/pkg/control/client/client_state_autogen.go index 69ea753a9..9872f1107 100755 --- a/pkg/control/client/client_state_autogen.go +++ b/pkg/control/client/client_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package client - diff --git a/pkg/control/server/server_state_autogen.go b/pkg/control/server/server_state_autogen.go index f2b4725d3..c236b8da5 100755 --- a/pkg/control/server/server_state_autogen.go +++ b/pkg/control/server/server_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package server - diff --git a/pkg/eventchannel/eventchannel_state_autogen.go b/pkg/eventchannel/eventchannel_state_autogen.go index cfd3a5e43..50b9c54b3 100755 --- a/pkg/eventchannel/eventchannel_state_autogen.go +++ b/pkg/eventchannel/eventchannel_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package eventchannel - diff --git a/pkg/fd/fd_state_autogen.go b/pkg/fd/fd_state_autogen.go index 0320140b0..5ad412976 100755 --- a/pkg/fd/fd_state_autogen.go +++ b/pkg/fd/fd_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package fd - diff --git a/pkg/fdchannel/fdchannel_state_autogen.go b/pkg/fdchannel/fdchannel_state_autogen.go index 07f179f84..61447d773 100755 --- a/pkg/fdchannel/fdchannel_state_autogen.go +++ b/pkg/fdchannel/fdchannel_state_autogen.go @@ -3,4 +3,3 @@ // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package fdchannel - diff --git a/pkg/fdnotifier/fdnotifier_state_autogen.go b/pkg/fdnotifier/fdnotifier_state_autogen.go index 63db30350..c665190ae 100755 --- a/pkg/fdnotifier/fdnotifier_state_autogen.go +++ b/pkg/fdnotifier/fdnotifier_state_autogen.go @@ -4,4 +4,3 @@ // +build linux package fdnotifier - diff --git a/pkg/flipcall/flipcall_linux_state_autogen.go b/pkg/flipcall/flipcall_linux_state_autogen.go index b22c04f05..ce37ac4e1 100755 --- a/pkg/flipcall/flipcall_linux_state_autogen.go +++ b/pkg/flipcall/flipcall_linux_state_autogen.go @@ -3,4 +3,3 @@ // +build linux package flipcall - diff --git a/pkg/flipcall/flipcall_state_autogen.go b/pkg/flipcall/flipcall_state_autogen.go index e9371b536..0e03c2a65 100755 --- a/pkg/flipcall/flipcall_state_autogen.go +++ b/pkg/flipcall/flipcall_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package flipcall - diff --git a/pkg/fspath/fspath_state_autogen.go b/pkg/fspath/fspath_state_autogen.go index 7f262b0a7..6ceea8003 100755 --- a/pkg/fspath/fspath_state_autogen.go +++ b/pkg/fspath/fspath_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package fspath - diff --git a/pkg/gate/gate_state_autogen.go b/pkg/gate/gate_state_autogen.go index a81fca776..221af659e 100755 --- a/pkg/gate/gate_state_autogen.go +++ b/pkg/gate/gate_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package gate - diff --git a/pkg/linewriter/linewriter_state_autogen.go b/pkg/linewriter/linewriter_state_autogen.go index 194088d76..1cd1df9b8 100755 --- a/pkg/linewriter/linewriter_state_autogen.go +++ b/pkg/linewriter/linewriter_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package linewriter - diff --git a/pkg/log/log_state_autogen.go b/pkg/log/log_state_autogen.go index 010b760a5..4e243c216 100755 --- a/pkg/log/log_state_autogen.go +++ b/pkg/log/log_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package log - diff --git a/pkg/memutil/memutil_state_autogen.go b/pkg/memutil/memutil_state_autogen.go index cdb738e7d..173297149 100755 --- a/pkg/memutil/memutil_state_autogen.go +++ b/pkg/memutil/memutil_state_autogen.go @@ -3,4 +3,3 @@ // +build linux package memutil - diff --git a/pkg/metric/metric.go b/pkg/metric/metric.go index 93d4f2b8c..006fcd9ab 100644 --- a/pkg/metric/metric.go +++ b/pkg/metric/metric.go @@ -46,7 +46,6 @@ var ( // // TODO(b/67298402): Support non-cumulative metrics. // TODO(b/67298427): Support metric fields. -// type Uint64Metric struct { // value is the actual value of the metric. It must be accessed // atomically. diff --git a/pkg/metric/metric_state_autogen.go b/pkg/metric/metric_state_autogen.go index 985c28832..36e5ed81b 100755 --- a/pkg/metric/metric_state_autogen.go +++ b/pkg/metric/metric_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package metric - diff --git a/pkg/p9/p9_state_autogen.go b/pkg/p9/p9_state_autogen.go index 0b9556862..bc9b1bd57 100755 --- a/pkg/p9/p9_state_autogen.go +++ b/pkg/p9/p9_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package p9 - diff --git a/pkg/procid/procid_state_autogen.go b/pkg/procid/procid_state_autogen.go index f27a7c510..662988d79 100755 --- a/pkg/procid/procid_state_autogen.go +++ b/pkg/procid/procid_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package procid - diff --git a/pkg/rand/rand_linux_state_autogen.go b/pkg/rand/rand_linux_state_autogen.go index e46e9ec7e..f727c9314 100755 --- a/pkg/rand/rand_linux_state_autogen.go +++ b/pkg/rand/rand_linux_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package rand - diff --git a/pkg/rand/rand_state_autogen.go b/pkg/rand/rand_state_autogen.go index d387ce1e1..e0a5cd184 100755 --- a/pkg/rand/rand_state_autogen.go +++ b/pkg/rand/rand_state_autogen.go @@ -3,4 +3,3 @@ // +build !linux package rand - diff --git a/pkg/safecopy/safecopy_state_autogen.go b/pkg/safecopy/safecopy_state_autogen.go index 58fd8fbd0..791eef959 100755 --- a/pkg/safecopy/safecopy_state_autogen.go +++ b/pkg/safecopy/safecopy_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package safecopy - diff --git a/pkg/safemem/safemem_state_autogen.go b/pkg/safemem/safemem_state_autogen.go index 7264df0b1..66d53f22d 100755 --- a/pkg/safemem/safemem_state_autogen.go +++ b/pkg/safemem/safemem_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package safemem - diff --git a/pkg/seccomp/seccomp_amd64_state_autogen.go b/pkg/seccomp/seccomp_amd64_state_autogen.go index 9aa3364d2..27a96018b 100755 --- a/pkg/seccomp/seccomp_amd64_state_autogen.go +++ b/pkg/seccomp/seccomp_amd64_state_autogen.go @@ -3,4 +3,3 @@ // +build amd64 package seccomp - diff --git a/pkg/seccomp/seccomp_arm64_state_autogen.go b/pkg/seccomp/seccomp_arm64_state_autogen.go index 49e5bbc8f..96c64c23d 100755 --- a/pkg/seccomp/seccomp_arm64_state_autogen.go +++ b/pkg/seccomp/seccomp_arm64_state_autogen.go @@ -3,4 +3,3 @@ // +build arm64 package seccomp - diff --git a/pkg/seccomp/seccomp_state_autogen.go b/pkg/seccomp/seccomp_state_autogen.go index 0fc23d1a8..e16b5d7c2 100755 --- a/pkg/seccomp/seccomp_state_autogen.go +++ b/pkg/seccomp/seccomp_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package seccomp - diff --git a/pkg/secio/secio_state_autogen.go b/pkg/secio/secio_state_autogen.go index ec559f264..372ac4b92 100755 --- a/pkg/secio/secio_state_autogen.go +++ b/pkg/secio/secio_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package secio - diff --git a/pkg/sentry/arch/arch_aarch64_state_autogen.go b/pkg/sentry/arch/arch_aarch64_state_autogen.go index 3e0685928..9c6dfdf2e 100755 --- a/pkg/sentry/arch/arch_aarch64_state_autogen.go +++ b/pkg/sentry/arch/arch_aarch64_state_autogen.go @@ -4,4 +4,3 @@ // +build arm64 package arch - diff --git a/pkg/sentry/arch/arch_arm64_state_autogen.go b/pkg/sentry/arch/arch_arm64_state_autogen.go index 4d56ebcca..49f2e3d67 100755 --- a/pkg/sentry/arch/arch_arm64_state_autogen.go +++ b/pkg/sentry/arch/arch_arm64_state_autogen.go @@ -3,4 +3,3 @@ // +build arm64 package arch - diff --git a/pkg/sentry/arch/arch_x86.go b/pkg/sentry/arch/arch_x86.go index a18093155..3db8bd34b 100644 --- a/pkg/sentry/arch/arch_x86.go +++ b/pkg/sentry/arch/arch_x86.go @@ -114,6 +114,10 @@ func newX86FPStateSlice() []byte { size, align := cpuid.HostFeatureSet().ExtendedStateSize() capacity := size // Always use at least 4096 bytes. + // + // For the KVM platform, this state is a fixed 4096 bytes, so make sure + // that the underlying array is at _least_ that size otherwise we will + // corrupt random memory. This is not a pleasant thing to debug. if capacity < 4096 { capacity = 4096 } diff --git a/pkg/sentry/arch/signal_amd64.go b/pkg/sentry/arch/signal_amd64.go index 81b92bb43..6fb756f0e 100644 --- a/pkg/sentry/arch/signal_amd64.go +++ b/pkg/sentry/arch/signal_amd64.go @@ -55,7 +55,7 @@ type SignalContext64 struct { Trapno uint64 Oldmask linux.SignalSet Cr2 uint64 - // Pointer to a struct _fpstate. + // Pointer to a struct _fpstate. See b/33003106#comment8. Fpstate uint64 Reserved [8]uint64 } diff --git a/pkg/sentry/control/control_state_autogen.go b/pkg/sentry/control/control_state_autogen.go index a1de4bc6d..bd5797221 100755 --- a/pkg/sentry/control/control_state_autogen.go +++ b/pkg/sentry/control/control_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package control - diff --git a/pkg/sentry/fs/anon/anon_state_autogen.go b/pkg/sentry/fs/anon/anon_state_autogen.go index fcb914212..b2b1a466e 100755 --- a/pkg/sentry/fs/anon/anon_state_autogen.go +++ b/pkg/sentry/fs/anon/anon_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package anon - diff --git a/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go b/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go index 38c1ed916..045e3c015 100755 --- a/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go +++ b/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go @@ -3,8 +3,8 @@ package fdpipe import ( - "gvisor.dev/gvisor/pkg/state" "gvisor.dev/gvisor/pkg/sentry/fs" + "gvisor.dev/gvisor/pkg/state" ) func (x *pipeOperations) save(m state.Map) { diff --git a/pkg/sentry/fs/fs_state_autogen.go b/pkg/sentry/fs/fs_state_autogen.go index a6820867d..18495fc95 100755 --- a/pkg/sentry/fs/fs_state_autogen.go +++ b/pkg/sentry/fs/fs_state_autogen.go @@ -192,8 +192,12 @@ func (x *Dirent) load(m state.Map) { func (x *DirentCache) beforeSave() {} func (x *DirentCache) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.currentSize) { m.Failf("currentSize is %v, expected zero", x.currentSize) } - if !state.IsZeroValue(x.list) { m.Failf("list is %v, expected zero", x.list) } + if !state.IsZeroValue(x.currentSize) { + m.Failf("currentSize is %v, expected zero", x.currentSize) + } + if !state.IsZeroValue(x.list) { + m.Failf("list is %v, expected zero", x.list) + } m.Save("maxSize", &x.maxSize) m.Save("limit", &x.limit) } @@ -207,7 +211,9 @@ func (x *DirentCache) load(m state.Map) { func (x *DirentCacheLimiter) beforeSave() {} func (x *DirentCacheLimiter) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.count) { m.Failf("count is %v, expected zero", x.count) } + if !state.IsZeroValue(x.count) { + m.Failf("count is %v, expected zero", x.count) + } m.Save("max", &x.max) } diff --git a/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go b/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go new file mode 100755 index 000000000..59bd445ac --- /dev/null +++ b/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go @@ -0,0 +1,169 @@ +// automatically generated by stateify. + +package fsutil + +import ( + "gvisor.dev/gvisor/pkg/state" +) + +func (x *DirtySet) beforeSave() {} +func (x *DirtySet) save(m state.Map) { + x.beforeSave() + var root *DirtySegmentDataSlices = x.saveRoot() + m.SaveValue("root", root) +} + +func (x *DirtySet) afterLoad() {} +func (x *DirtySet) load(m state.Map) { + m.LoadValue("root", new(*DirtySegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*DirtySegmentDataSlices)) }) +} + +func (x *Dirtynode) beforeSave() {} +func (x *Dirtynode) save(m state.Map) { + x.beforeSave() + m.Save("nrSegments", &x.nrSegments) + m.Save("parent", &x.parent) + m.Save("parentIndex", &x.parentIndex) + m.Save("hasChildren", &x.hasChildren) + m.Save("keys", &x.keys) + m.Save("values", &x.values) + m.Save("children", &x.children) +} + +func (x *Dirtynode) afterLoad() {} +func (x *Dirtynode) load(m state.Map) { + m.Load("nrSegments", &x.nrSegments) + m.Load("parent", &x.parent) + m.Load("parentIndex", &x.parentIndex) + m.Load("hasChildren", &x.hasChildren) + m.Load("keys", &x.keys) + m.Load("values", &x.values) + m.Load("children", &x.children) +} + +func (x *DirtySegmentDataSlices) beforeSave() {} +func (x *DirtySegmentDataSlices) save(m state.Map) { + x.beforeSave() + m.Save("Start", &x.Start) + m.Save("End", &x.End) + m.Save("Values", &x.Values) +} + +func (x *DirtySegmentDataSlices) afterLoad() {} +func (x *DirtySegmentDataSlices) load(m state.Map) { + m.Load("Start", &x.Start) + m.Load("End", &x.End) + m.Load("Values", &x.Values) +} + +func (x *FileRangeSet) beforeSave() {} +func (x *FileRangeSet) save(m state.Map) { + x.beforeSave() + var root *FileRangeSegmentDataSlices = x.saveRoot() + m.SaveValue("root", root) +} + +func (x *FileRangeSet) afterLoad() {} +func (x *FileRangeSet) load(m state.Map) { + m.LoadValue("root", new(*FileRangeSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FileRangeSegmentDataSlices)) }) +} + +func (x *FileRangenode) beforeSave() {} +func (x *FileRangenode) save(m state.Map) { + x.beforeSave() + m.Save("nrSegments", &x.nrSegments) + m.Save("parent", &x.parent) + m.Save("parentIndex", &x.parentIndex) + m.Save("hasChildren", &x.hasChildren) + m.Save("keys", &x.keys) + m.Save("values", &x.values) + m.Save("children", &x.children) +} + +func (x *FileRangenode) afterLoad() {} +func (x *FileRangenode) load(m state.Map) { + m.Load("nrSegments", &x.nrSegments) + m.Load("parent", &x.parent) + m.Load("parentIndex", &x.parentIndex) + m.Load("hasChildren", &x.hasChildren) + m.Load("keys", &x.keys) + m.Load("values", &x.values) + m.Load("children", &x.children) +} + +func (x *FileRangeSegmentDataSlices) beforeSave() {} +func (x *FileRangeSegmentDataSlices) save(m state.Map) { + x.beforeSave() + m.Save("Start", &x.Start) + m.Save("End", &x.End) + m.Save("Values", &x.Values) +} + +func (x *FileRangeSegmentDataSlices) afterLoad() {} +func (x *FileRangeSegmentDataSlices) load(m state.Map) { + m.Load("Start", &x.Start) + m.Load("End", &x.End) + m.Load("Values", &x.Values) +} + +func (x *FrameRefSet) beforeSave() {} +func (x *FrameRefSet) save(m state.Map) { + x.beforeSave() + var root *FrameRefSegmentDataSlices = x.saveRoot() + m.SaveValue("root", root) +} + +func (x *FrameRefSet) afterLoad() {} +func (x *FrameRefSet) load(m state.Map) { + m.LoadValue("root", new(*FrameRefSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FrameRefSegmentDataSlices)) }) +} + +func (x *FrameRefnode) beforeSave() {} +func (x *FrameRefnode) save(m state.Map) { + x.beforeSave() + m.Save("nrSegments", &x.nrSegments) + m.Save("parent", &x.parent) + m.Save("parentIndex", &x.parentIndex) + m.Save("hasChildren", &x.hasChildren) + m.Save("keys", &x.keys) + m.Save("values", &x.values) + m.Save("children", &x.children) +} + +func (x *FrameRefnode) afterLoad() {} +func (x *FrameRefnode) load(m state.Map) { + m.Load("nrSegments", &x.nrSegments) + m.Load("parent", &x.parent) + m.Load("parentIndex", &x.parentIndex) + m.Load("hasChildren", &x.hasChildren) + m.Load("keys", &x.keys) + m.Load("values", &x.values) + m.Load("children", &x.children) +} + +func (x *FrameRefSegmentDataSlices) beforeSave() {} +func (x *FrameRefSegmentDataSlices) save(m state.Map) { + x.beforeSave() + m.Save("Start", &x.Start) + m.Save("End", &x.End) + m.Save("Values", &x.Values) +} + +func (x *FrameRefSegmentDataSlices) afterLoad() {} +func (x *FrameRefSegmentDataSlices) load(m state.Map) { + m.Load("Start", &x.Start) + m.Load("End", &x.End) + m.Load("Values", &x.Values) +} + +func init() { + state.Register("fsutil.DirtySet", (*DirtySet)(nil), state.Fns{Save: (*DirtySet).save, Load: (*DirtySet).load}) + state.Register("fsutil.Dirtynode", (*Dirtynode)(nil), state.Fns{Save: (*Dirtynode).save, Load: (*Dirtynode).load}) + state.Register("fsutil.DirtySegmentDataSlices", (*DirtySegmentDataSlices)(nil), state.Fns{Save: (*DirtySegmentDataSlices).save, Load: (*DirtySegmentDataSlices).load}) + state.Register("fsutil.FileRangeSet", (*FileRangeSet)(nil), state.Fns{Save: (*FileRangeSet).save, Load: (*FileRangeSet).load}) + state.Register("fsutil.FileRangenode", (*FileRangenode)(nil), state.Fns{Save: (*FileRangenode).save, Load: (*FileRangenode).load}) + state.Register("fsutil.FileRangeSegmentDataSlices", (*FileRangeSegmentDataSlices)(nil), state.Fns{Save: (*FileRangeSegmentDataSlices).save, Load: (*FileRangeSegmentDataSlices).load}) + state.Register("fsutil.FrameRefSet", (*FrameRefSet)(nil), state.Fns{Save: (*FrameRefSet).save, Load: (*FrameRefSet).load}) + state.Register("fsutil.FrameRefnode", (*FrameRefnode)(nil), state.Fns{Save: (*FrameRefnode).save, Load: (*FrameRefnode).load}) + state.Register("fsutil.FrameRefSegmentDataSlices", (*FrameRefSegmentDataSlices)(nil), state.Fns{Save: (*FrameRefSegmentDataSlices).save, Load: (*FrameRefSegmentDataSlices).load}) +} diff --git a/pkg/sentry/fs/fsutil/fsutil_state_autogen.go b/pkg/sentry/fs/fsutil/fsutil_state_autogen.go index 3f710099f..284c3dab6 100755 --- a/pkg/sentry/fs/fsutil/fsutil_state_autogen.go +++ b/pkg/sentry/fs/fsutil/fsutil_state_autogen.go @@ -17,56 +17,6 @@ func (x *DirtyInfo) load(m state.Map) { m.Load("Keep", &x.Keep) } -func (x *DirtySet) beforeSave() {} -func (x *DirtySet) save(m state.Map) { - x.beforeSave() - var root *DirtySegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) -} - -func (x *DirtySet) afterLoad() {} -func (x *DirtySet) load(m state.Map) { - m.LoadValue("root", new(*DirtySegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*DirtySegmentDataSlices)) }) -} - -func (x *Dirtynode) beforeSave() {} -func (x *Dirtynode) save(m state.Map) { - x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) -} - -func (x *Dirtynode) afterLoad() {} -func (x *Dirtynode) load(m state.Map) { - m.Load("nrSegments", &x.nrSegments) - m.Load("parent", &x.parent) - m.Load("parentIndex", &x.parentIndex) - m.Load("hasChildren", &x.hasChildren) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) -} - -func (x *DirtySegmentDataSlices) beforeSave() {} -func (x *DirtySegmentDataSlices) save(m state.Map) { - x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) -} - -func (x *DirtySegmentDataSlices) afterLoad() {} -func (x *DirtySegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) -} - func (x *StaticDirFileOperations) beforeSave() {} func (x *StaticDirFileOperations) save(m state.Map) { x.beforeSave() @@ -100,106 +50,6 @@ func (x *FileStaticContentReader) load(m state.Map) { m.Load("content", &x.content) } -func (x *FileRangeSet) beforeSave() {} -func (x *FileRangeSet) save(m state.Map) { - x.beforeSave() - var root *FileRangeSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) -} - -func (x *FileRangeSet) afterLoad() {} -func (x *FileRangeSet) load(m state.Map) { - m.LoadValue("root", new(*FileRangeSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FileRangeSegmentDataSlices)) }) -} - -func (x *FileRangenode) beforeSave() {} -func (x *FileRangenode) save(m state.Map) { - x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) -} - -func (x *FileRangenode) afterLoad() {} -func (x *FileRangenode) load(m state.Map) { - m.Load("nrSegments", &x.nrSegments) - m.Load("parent", &x.parent) - m.Load("parentIndex", &x.parentIndex) - m.Load("hasChildren", &x.hasChildren) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) -} - -func (x *FileRangeSegmentDataSlices) beforeSave() {} -func (x *FileRangeSegmentDataSlices) save(m state.Map) { - x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) -} - -func (x *FileRangeSegmentDataSlices) afterLoad() {} -func (x *FileRangeSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) -} - -func (x *FrameRefSet) beforeSave() {} -func (x *FrameRefSet) save(m state.Map) { - x.beforeSave() - var root *FrameRefSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) -} - -func (x *FrameRefSet) afterLoad() {} -func (x *FrameRefSet) load(m state.Map) { - m.LoadValue("root", new(*FrameRefSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FrameRefSegmentDataSlices)) }) -} - -func (x *FrameRefnode) beforeSave() {} -func (x *FrameRefnode) save(m state.Map) { - x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) -} - -func (x *FrameRefnode) afterLoad() {} -func (x *FrameRefnode) load(m state.Map) { - m.Load("nrSegments", &x.nrSegments) - m.Load("parent", &x.parent) - m.Load("parentIndex", &x.parentIndex) - m.Load("hasChildren", &x.hasChildren) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) -} - -func (x *FrameRefSegmentDataSlices) beforeSave() {} -func (x *FrameRefSegmentDataSlices) save(m state.Map) { - x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) -} - -func (x *FrameRefSegmentDataSlices) afterLoad() {} -func (x *FrameRefSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) -} - func (x *HostFileMapper) beforeSave() {} func (x *HostFileMapper) save(m state.Map) { x.beforeSave() @@ -338,18 +188,9 @@ func (x *CachingInodeOperationsOptions) load(m state.Map) { func init() { state.Register("fsutil.DirtyInfo", (*DirtyInfo)(nil), state.Fns{Save: (*DirtyInfo).save, Load: (*DirtyInfo).load}) - state.Register("fsutil.DirtySet", (*DirtySet)(nil), state.Fns{Save: (*DirtySet).save, Load: (*DirtySet).load}) - state.Register("fsutil.Dirtynode", (*Dirtynode)(nil), state.Fns{Save: (*Dirtynode).save, Load: (*Dirtynode).load}) - state.Register("fsutil.DirtySegmentDataSlices", (*DirtySegmentDataSlices)(nil), state.Fns{Save: (*DirtySegmentDataSlices).save, Load: (*DirtySegmentDataSlices).load}) state.Register("fsutil.StaticDirFileOperations", (*StaticDirFileOperations)(nil), state.Fns{Save: (*StaticDirFileOperations).save, Load: (*StaticDirFileOperations).load}) state.Register("fsutil.NoReadWriteFile", (*NoReadWriteFile)(nil), state.Fns{Save: (*NoReadWriteFile).save, Load: (*NoReadWriteFile).load}) state.Register("fsutil.FileStaticContentReader", (*FileStaticContentReader)(nil), state.Fns{Save: (*FileStaticContentReader).save, Load: (*FileStaticContentReader).load}) - state.Register("fsutil.FileRangeSet", (*FileRangeSet)(nil), state.Fns{Save: (*FileRangeSet).save, Load: (*FileRangeSet).load}) - state.Register("fsutil.FileRangenode", (*FileRangenode)(nil), state.Fns{Save: (*FileRangenode).save, Load: (*FileRangenode).load}) - state.Register("fsutil.FileRangeSegmentDataSlices", (*FileRangeSegmentDataSlices)(nil), state.Fns{Save: (*FileRangeSegmentDataSlices).save, Load: (*FileRangeSegmentDataSlices).load}) - state.Register("fsutil.FrameRefSet", (*FrameRefSet)(nil), state.Fns{Save: (*FrameRefSet).save, Load: (*FrameRefSet).load}) - state.Register("fsutil.FrameRefnode", (*FrameRefnode)(nil), state.Fns{Save: (*FrameRefnode).save, Load: (*FrameRefnode).load}) - state.Register("fsutil.FrameRefSegmentDataSlices", (*FrameRefSegmentDataSlices)(nil), state.Fns{Save: (*FrameRefSegmentDataSlices).save, Load: (*FrameRefSegmentDataSlices).load}) state.Register("fsutil.HostFileMapper", (*HostFileMapper)(nil), state.Fns{Save: (*HostFileMapper).save, Load: (*HostFileMapper).load}) state.Register("fsutil.HostMappable", (*HostMappable)(nil), state.Fns{Save: (*HostMappable).save, Load: (*HostMappable).load}) state.Register("fsutil.SimpleFileInode", (*SimpleFileInode)(nil), state.Fns{Save: (*SimpleFileInode).save, Load: (*SimpleFileInode).load}) diff --git a/pkg/sentry/fs/host/host_amd64_unsafe_state_autogen.go b/pkg/sentry/fs/host/host_amd64_unsafe_state_autogen.go index de35761e1..488cbdfcf 100755 --- a/pkg/sentry/fs/host/host_amd64_unsafe_state_autogen.go +++ b/pkg/sentry/fs/host/host_amd64_unsafe_state_autogen.go @@ -3,4 +3,3 @@ // +build amd64 package host - diff --git a/pkg/sentry/fs/host/host_arm64_unsafe_state_autogen.go b/pkg/sentry/fs/host/host_arm64_unsafe_state_autogen.go index ecbc3dd77..7371b44db 100755 --- a/pkg/sentry/fs/host/host_arm64_unsafe_state_autogen.go +++ b/pkg/sentry/fs/host/host_arm64_unsafe_state_autogen.go @@ -3,4 +3,3 @@ // +build arm64 package host - diff --git a/pkg/sentry/fs/host/host_state_autogen.go b/pkg/sentry/fs/host/host_state_autogen.go index e5c487320..d2c40f456 100755 --- a/pkg/sentry/fs/host/host_state_autogen.go +++ b/pkg/sentry/fs/host/host_state_autogen.go @@ -78,7 +78,9 @@ func (x *inodeOperations) load(m state.Map) { func (x *inodeFileState) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.queue) { m.Failf("queue is %v, expected zero", x.queue) } + if !state.IsZeroValue(x.queue) { + m.Failf("queue is %v, expected zero", x.queue) + } m.Save("mops", &x.mops) m.Save("descriptor", &x.descriptor) m.Save("sattr", &x.sattr) diff --git a/pkg/sentry/fs/lock/lock_state_autogen.go b/pkg/sentry/fs/lock/lock_state_autogen.go index cb69e2cd0..ff1200c4c 100755 --- a/pkg/sentry/fs/lock/lock_state_autogen.go +++ b/pkg/sentry/fs/lock/lock_state_autogen.go @@ -24,7 +24,9 @@ func (x *Lock) load(m state.Map) { func (x *Locks) beforeSave() {} func (x *Locks) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.blockedQueue) { m.Failf("blockedQueue is %v, expected zero", x.blockedQueue) } + if !state.IsZeroValue(x.blockedQueue) { + m.Failf("blockedQueue is %v, expected zero", x.blockedQueue) + } m.Save("locks", &x.locks) } diff --git a/pkg/sentry/fs/proc/device/device_state_autogen.go b/pkg/sentry/fs/proc/device/device_state_autogen.go index be407ac45..4a5e3cc88 100755 --- a/pkg/sentry/fs/proc/device/device_state_autogen.go +++ b/pkg/sentry/fs/proc/device/device_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package device - diff --git a/pkg/sentry/fs/timerfd/timerfd_state_autogen.go b/pkg/sentry/fs/timerfd/timerfd_state_autogen.go index e8d98af97..cbbbf972c 100755 --- a/pkg/sentry/fs/timerfd/timerfd_state_autogen.go +++ b/pkg/sentry/fs/timerfd/timerfd_state_autogen.go @@ -9,7 +9,9 @@ import ( func (x *TimerOperations) beforeSave() {} func (x *TimerOperations) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.events) { m.Failf("events is %v, expected zero", x.events) } + if !state.IsZeroValue(x.events) { + m.Failf("events is %v, expected zero", x.events) + } m.Save("timer", &x.timer) m.Save("val", &x.val) } diff --git a/pkg/sentry/fs/tty/tty_state_autogen.go b/pkg/sentry/fs/tty/tty_state_autogen.go index c54600104..28e75eb33 100755 --- a/pkg/sentry/fs/tty/tty_state_autogen.go +++ b/pkg/sentry/fs/tty/tty_state_autogen.go @@ -61,8 +61,12 @@ func (x *superOperations) load(m state.Map) { func (x *lineDiscipline) beforeSave() {} func (x *lineDiscipline) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.masterWaiter) { m.Failf("masterWaiter is %v, expected zero", x.masterWaiter) } - if !state.IsZeroValue(x.slaveWaiter) { m.Failf("slaveWaiter is %v, expected zero", x.slaveWaiter) } + if !state.IsZeroValue(x.masterWaiter) { + m.Failf("masterWaiter is %v, expected zero", x.masterWaiter) + } + if !state.IsZeroValue(x.slaveWaiter) { + m.Failf("slaveWaiter is %v, expected zero", x.slaveWaiter) + } m.Save("size", &x.size) m.Save("inQueue", &x.inQueue) m.Save("outQueue", &x.outQueue) diff --git a/pkg/sentry/hostcpu/hostcpu_state_autogen.go b/pkg/sentry/hostcpu/hostcpu_state_autogen.go index f04a56ec0..97d33d8bf 100755 --- a/pkg/sentry/hostcpu/hostcpu_state_autogen.go +++ b/pkg/sentry/hostcpu/hostcpu_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package hostcpu - diff --git a/pkg/sentry/hostmm/hostmm_state_autogen.go b/pkg/sentry/hostmm/hostmm_state_autogen.go index 730de5101..925c56e14 100755 --- a/pkg/sentry/hostmm/hostmm_state_autogen.go +++ b/pkg/sentry/hostmm/hostmm_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package hostmm - 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) } diff --git a/pkg/sentry/memmap/memmap_impl_state_autogen.go b/pkg/sentry/memmap/memmap_impl_state_autogen.go new file mode 100755 index 000000000..53cebac8c --- /dev/null +++ b/pkg/sentry/memmap/memmap_impl_state_autogen.go @@ -0,0 +1,63 @@ +// automatically generated by stateify. + +package memmap + +import ( + "gvisor.dev/gvisor/pkg/state" +) + +func (x *MappingSet) beforeSave() {} +func (x *MappingSet) save(m state.Map) { + x.beforeSave() + var root *MappingSegmentDataSlices = x.saveRoot() + m.SaveValue("root", root) +} + +func (x *MappingSet) afterLoad() {} +func (x *MappingSet) load(m state.Map) { + m.LoadValue("root", new(*MappingSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*MappingSegmentDataSlices)) }) +} + +func (x *Mappingnode) beforeSave() {} +func (x *Mappingnode) save(m state.Map) { + x.beforeSave() + m.Save("nrSegments", &x.nrSegments) + m.Save("parent", &x.parent) + m.Save("parentIndex", &x.parentIndex) + m.Save("hasChildren", &x.hasChildren) + m.Save("keys", &x.keys) + m.Save("values", &x.values) + m.Save("children", &x.children) +} + +func (x *Mappingnode) afterLoad() {} +func (x *Mappingnode) load(m state.Map) { + m.Load("nrSegments", &x.nrSegments) + m.Load("parent", &x.parent) + m.Load("parentIndex", &x.parentIndex) + m.Load("hasChildren", &x.hasChildren) + m.Load("keys", &x.keys) + m.Load("values", &x.values) + m.Load("children", &x.children) +} + +func (x *MappingSegmentDataSlices) beforeSave() {} +func (x *MappingSegmentDataSlices) save(m state.Map) { + x.beforeSave() + m.Save("Start", &x.Start) + m.Save("End", &x.End) + m.Save("Values", &x.Values) +} + +func (x *MappingSegmentDataSlices) afterLoad() {} +func (x *MappingSegmentDataSlices) load(m state.Map) { + m.Load("Start", &x.Start) + m.Load("End", &x.End) + m.Load("Values", &x.Values) +} + +func init() { + state.Register("memmap.MappingSet", (*MappingSet)(nil), state.Fns{Save: (*MappingSet).save, Load: (*MappingSet).load}) + state.Register("memmap.Mappingnode", (*Mappingnode)(nil), state.Fns{Save: (*Mappingnode).save, Load: (*Mappingnode).load}) + state.Register("memmap.MappingSegmentDataSlices", (*MappingSegmentDataSlices)(nil), state.Fns{Save: (*MappingSegmentDataSlices).save, Load: (*MappingSegmentDataSlices).load}) +} diff --git a/pkg/sentry/memmap/memmap_state_autogen.go b/pkg/sentry/memmap/memmap_state_autogen.go index 2d0814ab1..16107f949 100755 --- a/pkg/sentry/memmap/memmap_state_autogen.go +++ b/pkg/sentry/memmap/memmap_state_autogen.go @@ -34,60 +34,7 @@ func (x *MappingOfRange) load(m state.Map) { m.Load("Writable", &x.Writable) } -func (x *MappingSet) beforeSave() {} -func (x *MappingSet) save(m state.Map) { - x.beforeSave() - var root *MappingSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) -} - -func (x *MappingSet) afterLoad() {} -func (x *MappingSet) load(m state.Map) { - m.LoadValue("root", new(*MappingSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*MappingSegmentDataSlices)) }) -} - -func (x *Mappingnode) beforeSave() {} -func (x *Mappingnode) save(m state.Map) { - x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) -} - -func (x *Mappingnode) afterLoad() {} -func (x *Mappingnode) load(m state.Map) { - m.Load("nrSegments", &x.nrSegments) - m.Load("parent", &x.parent) - m.Load("parentIndex", &x.parentIndex) - m.Load("hasChildren", &x.hasChildren) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) -} - -func (x *MappingSegmentDataSlices) beforeSave() {} -func (x *MappingSegmentDataSlices) save(m state.Map) { - x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) -} - -func (x *MappingSegmentDataSlices) afterLoad() {} -func (x *MappingSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) -} - func init() { state.Register("memmap.MappableRange", (*MappableRange)(nil), state.Fns{Save: (*MappableRange).save, Load: (*MappableRange).load}) state.Register("memmap.MappingOfRange", (*MappingOfRange)(nil), state.Fns{Save: (*MappingOfRange).save, Load: (*MappingOfRange).load}) - state.Register("memmap.MappingSet", (*MappingSet)(nil), state.Fns{Save: (*MappingSet).save, Load: (*MappingSet).load}) - state.Register("memmap.Mappingnode", (*Mappingnode)(nil), state.Fns{Save: (*Mappingnode).save, Load: (*Mappingnode).load}) - state.Register("memmap.MappingSegmentDataSlices", (*MappingSegmentDataSlices)(nil), state.Fns{Save: (*MappingSegmentDataSlices).save, Load: (*MappingSegmentDataSlices).load}) } diff --git a/pkg/sentry/mm/mm_state_autogen.go b/pkg/sentry/mm/mm_state_autogen.go index 3b5af2401..9a9b4347d 100755 --- a/pkg/sentry/mm/mm_state_autogen.go +++ b/pkg/sentry/mm/mm_state_autogen.go @@ -33,7 +33,9 @@ func (x *ioResult) load(m state.Map) { func (x *AIOContext) beforeSave() {} func (x *AIOContext) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.dead) { m.Failf("dead is %v, expected zero", x.dead) } + if !state.IsZeroValue(x.dead) { + m.Failf("dead is %v, expected zero", x.dead) + } m.Save("results", &x.results) m.Save("maxOutstanding", &x.maxOutstanding) m.Save("outstanding", &x.outstanding) @@ -139,8 +141,12 @@ func (x *ioEntry) load(m state.Map) { func (x *MemoryManager) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.active) { m.Failf("active is %v, expected zero", x.active) } - if !state.IsZeroValue(x.captureInvalidations) { m.Failf("captureInvalidations is %v, expected zero", x.captureInvalidations) } + if !state.IsZeroValue(x.active) { + m.Failf("active is %v, expected zero", x.active) + } + if !state.IsZeroValue(x.captureInvalidations) { + m.Failf("captureInvalidations is %v, expected zero", x.captureInvalidations) + } m.Save("p", &x.p) m.Save("mfp", &x.mfp) m.Save("layout", &x.layout) diff --git a/pkg/sentry/platform/interrupt/interrupt_state_autogen.go b/pkg/sentry/platform/interrupt/interrupt_state_autogen.go index 15e8bacdf..1336e5f01 100755 --- a/pkg/sentry/platform/interrupt/interrupt_state_autogen.go +++ b/pkg/sentry/platform/interrupt/interrupt_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package interrupt - diff --git a/pkg/sentry/platform/kvm/kvm_amd64_state_autogen.go b/pkg/sentry/platform/kvm/kvm_amd64_state_autogen.go index 0c21ccdb4..a69cbee8b 100755 --- a/pkg/sentry/platform/kvm/kvm_amd64_state_autogen.go +++ b/pkg/sentry/platform/kvm/kvm_amd64_state_autogen.go @@ -5,4 +5,3 @@ // +build amd64 package kvm - diff --git a/pkg/sentry/platform/kvm/kvm_amd64_unsafe_state_autogen.go b/pkg/sentry/platform/kvm/kvm_amd64_unsafe_state_autogen.go index 0c21ccdb4..a69cbee8b 100755 --- a/pkg/sentry/platform/kvm/kvm_amd64_unsafe_state_autogen.go +++ b/pkg/sentry/platform/kvm/kvm_amd64_unsafe_state_autogen.go @@ -5,4 +5,3 @@ // +build amd64 package kvm - diff --git a/pkg/sentry/platform/kvm/kvm_arm64_state_autogen.go b/pkg/sentry/platform/kvm/kvm_arm64_state_autogen.go index 94b93bea5..90183b764 100755 --- a/pkg/sentry/platform/kvm/kvm_arm64_state_autogen.go +++ b/pkg/sentry/platform/kvm/kvm_arm64_state_autogen.go @@ -5,4 +5,3 @@ // +build arm64 package kvm - diff --git a/pkg/sentry/platform/kvm/kvm_arm64_unsafe_state_autogen.go b/pkg/sentry/platform/kvm/kvm_arm64_unsafe_state_autogen.go index 94b93bea5..90183b764 100755 --- a/pkg/sentry/platform/kvm/kvm_arm64_unsafe_state_autogen.go +++ b/pkg/sentry/platform/kvm/kvm_arm64_unsafe_state_autogen.go @@ -5,4 +5,3 @@ // +build arm64 package kvm - diff --git a/pkg/sentry/platform/kvm/kvm_state_autogen.go b/pkg/sentry/platform/kvm/kvm_state_autogen.go index f34ac0945..2325262dc 100755 --- a/pkg/sentry/platform/kvm/kvm_state_autogen.go +++ b/pkg/sentry/platform/kvm/kvm_state_autogen.go @@ -6,4 +6,3 @@ // +build !go1.15 package kvm - diff --git a/pkg/sentry/platform/ptrace/ptrace_amd64_state_autogen.go b/pkg/sentry/platform/ptrace/ptrace_amd64_state_autogen.go index 09e133aac..f730ab393 100755 --- a/pkg/sentry/platform/ptrace/ptrace_amd64_state_autogen.go +++ b/pkg/sentry/platform/ptrace/ptrace_amd64_state_autogen.go @@ -3,4 +3,3 @@ // +build amd64 package ptrace - diff --git a/pkg/sentry/platform/ptrace/ptrace_arm64_state_autogen.go b/pkg/sentry/platform/ptrace/ptrace_arm64_state_autogen.go index 78ce51a66..6239d1305 100755 --- a/pkg/sentry/platform/ptrace/ptrace_arm64_state_autogen.go +++ b/pkg/sentry/platform/ptrace/ptrace_arm64_state_autogen.go @@ -3,4 +3,3 @@ // +build arm64 package ptrace - diff --git a/pkg/sentry/platform/ptrace/ptrace_linux_state_autogen.go b/pkg/sentry/platform/ptrace/ptrace_linux_state_autogen.go index 67b04a65b..9f90aef93 100755 --- a/pkg/sentry/platform/ptrace/ptrace_linux_state_autogen.go +++ b/pkg/sentry/platform/ptrace/ptrace_linux_state_autogen.go @@ -3,4 +3,3 @@ // +build linux package ptrace - diff --git a/pkg/sentry/platform/ptrace/ptrace_linux_unsafe_state_autogen.go b/pkg/sentry/platform/ptrace/ptrace_linux_unsafe_state_autogen.go index bfea2ad67..45d94c547 100755 --- a/pkg/sentry/platform/ptrace/ptrace_linux_unsafe_state_autogen.go +++ b/pkg/sentry/platform/ptrace/ptrace_linux_unsafe_state_autogen.go @@ -4,4 +4,3 @@ // +build amd64 arm64 package ptrace - diff --git a/pkg/sentry/platform/ptrace/ptrace_state_autogen.go b/pkg/sentry/platform/ptrace/ptrace_state_autogen.go index 3a0b1ca8d..4526fc387 100755 --- a/pkg/sentry/platform/ptrace/ptrace_state_autogen.go +++ b/pkg/sentry/platform/ptrace/ptrace_state_autogen.go @@ -4,4 +4,3 @@ // +build !go1.15 package ptrace - diff --git a/pkg/sentry/platform/ring0/pagetables/pagetables_aarch64_state_autogen.go b/pkg/sentry/platform/ring0/pagetables/pagetables_aarch64_state_autogen.go index 31ec1653a..ae9d2b272 100755 --- a/pkg/sentry/platform/ring0/pagetables/pagetables_aarch64_state_autogen.go +++ b/pkg/sentry/platform/ring0/pagetables/pagetables_aarch64_state_autogen.go @@ -3,4 +3,3 @@ // +build arm64 package pagetables - diff --git a/pkg/sentry/platform/ring0/pagetables/pagetables_amd64_state_autogen.go b/pkg/sentry/platform/ring0/pagetables/pagetables_amd64_state_autogen.go index d1ad040cd..f48a8acd1 100755 --- a/pkg/sentry/platform/ring0/pagetables/pagetables_amd64_state_autogen.go +++ b/pkg/sentry/platform/ring0/pagetables/pagetables_amd64_state_autogen.go @@ -3,4 +3,3 @@ // +build amd64 package pagetables - diff --git a/pkg/sentry/platform/ring0/pagetables/pagetables_arm64_state_autogen.go b/pkg/sentry/platform/ring0/pagetables/pagetables_arm64_state_autogen.go index 31ec1653a..ae9d2b272 100755 --- a/pkg/sentry/platform/ring0/pagetables/pagetables_arm64_state_autogen.go +++ b/pkg/sentry/platform/ring0/pagetables/pagetables_arm64_state_autogen.go @@ -3,4 +3,3 @@ // +build arm64 package pagetables - diff --git a/pkg/sentry/platform/ring0/pagetables/pagetables_state_autogen.go b/pkg/sentry/platform/ring0/pagetables/pagetables_state_autogen.go index 2cebb95e4..c1148613d 100755 --- a/pkg/sentry/platform/ring0/pagetables/pagetables_state_autogen.go +++ b/pkg/sentry/platform/ring0/pagetables/pagetables_state_autogen.go @@ -4,4 +4,3 @@ // +build i386 amd64 package pagetables - diff --git a/pkg/sentry/platform/ring0/ring0_amd64_state_autogen.go b/pkg/sentry/platform/ring0/ring0_amd64_state_autogen.go index 6d8150b0e..96cf5d331 100755 --- a/pkg/sentry/platform/ring0/ring0_amd64_state_autogen.go +++ b/pkg/sentry/platform/ring0/ring0_amd64_state_autogen.go @@ -5,4 +5,3 @@ // +build amd64 package ring0 - diff --git a/pkg/sentry/platform/ring0/ring0_arm64_state_autogen.go b/pkg/sentry/platform/ring0/ring0_arm64_state_autogen.go index 392e48d4b..7f2ab3537 100755 --- a/pkg/sentry/platform/ring0/ring0_arm64_state_autogen.go +++ b/pkg/sentry/platform/ring0/ring0_arm64_state_autogen.go @@ -5,4 +5,3 @@ // +build arm64 package ring0 - diff --git a/pkg/sentry/platform/ring0/ring0_state_autogen.go b/pkg/sentry/platform/ring0/ring0_state_autogen.go index 462f9a446..327aba163 100755 --- a/pkg/sentry/platform/ring0/ring0_state_autogen.go +++ b/pkg/sentry/platform/ring0/ring0_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package ring0 - diff --git a/pkg/sentry/sighandling/sighandling_state_autogen.go b/pkg/sentry/sighandling/sighandling_state_autogen.go index dad4bdda2..da9d96382 100755 --- a/pkg/sentry/sighandling/sighandling_state_autogen.go +++ b/pkg/sentry/sighandling/sighandling_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package sighandling - diff --git a/pkg/sentry/socket/control/control_state_autogen.go b/pkg/sentry/socket/control/control_state_autogen.go index c5ecfe700..6271abd8c 100755 --- a/pkg/sentry/socket/control/control_state_autogen.go +++ b/pkg/sentry/socket/control/control_state_autogen.go @@ -3,8 +3,8 @@ package control import ( - "gvisor.dev/gvisor/pkg/state" "gvisor.dev/gvisor/pkg/sentry/fs" + "gvisor.dev/gvisor/pkg/state" ) func (x *RightsFiles) save(m state.Map) { diff --git a/pkg/sentry/socket/hostinet/hostinet_impl_state_autogen.go b/pkg/sentry/socket/hostinet/hostinet_impl_state_autogen.go new file mode 100755 index 000000000..b0a59ba93 --- /dev/null +++ b/pkg/sentry/socket/hostinet/hostinet_impl_state_autogen.go @@ -0,0 +1,3 @@ +// automatically generated by stateify. + +package hostinet diff --git a/pkg/sentry/socket/hostinet/hostinet_state_autogen.go b/pkg/sentry/socket/hostinet/hostinet_state_autogen.go index 0a5c7cdf3..b0a59ba93 100755 --- a/pkg/sentry/socket/hostinet/hostinet_state_autogen.go +++ b/pkg/sentry/socket/hostinet/hostinet_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package hostinet - diff --git a/pkg/sentry/socket/hostinet/socket.go b/pkg/sentry/socket/hostinet/socket.go index 34f63986f..de76388ac 100644 --- a/pkg/sentry/socket/hostinet/socket.go +++ b/pkg/sentry/socket/hostinet/socket.go @@ -285,7 +285,7 @@ func (s *socketOperations) GetSockOpt(t *kernel.Task, level int, name int, outPt } // Whitelist options and constrain option length. - var optlen int + optlen := getSockOptLen(t, level, name) switch level { case linux.SOL_IP: switch name { @@ -330,7 +330,7 @@ func (s *socketOperations) GetSockOpt(t *kernel.Task, level int, name int, outPt // SetSockOpt implements socket.Socket.SetSockOpt. func (s *socketOperations) SetSockOpt(t *kernel.Task, level int, name int, opt []byte) *syserr.Error { // Whitelist options and constrain option length. - var optlen int + optlen := setSockOptLen(t, level, name) switch level { case linux.SOL_IP: switch name { @@ -353,6 +353,7 @@ func (s *socketOperations) SetSockOpt(t *kernel.Task, level int, name int, opt [ optlen = sizeofInt32 } } + if optlen == 0 { // Pretend to accept socket options we don't understand. This seems // dangerous, but it's what netstack does... diff --git a/pkg/sentry/socket/hostinet/sockopt_impl.go b/pkg/sentry/socket/hostinet/sockopt_impl.go new file mode 100755 index 000000000..8a783712e --- /dev/null +++ b/pkg/sentry/socket/hostinet/sockopt_impl.go @@ -0,0 +1,27 @@ +// 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 hostinet + +import ( + "gvisor.dev/gvisor/pkg/sentry/kernel" +) + +func getSockOptLen(t *kernel.Task, level, name int) int { + return 0 // No custom options. +} + +func setSockOptLen(t *kernel.Task, level, name int) int { + return 0 // No custom options. +} diff --git a/pkg/sentry/socket/netfilter/netfilter_state_autogen.go b/pkg/sentry/socket/netfilter/netfilter_state_autogen.go index f3d68dd64..6e95d89a4 100755 --- a/pkg/sentry/socket/netfilter/netfilter_state_autogen.go +++ b/pkg/sentry/socket/netfilter/netfilter_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package netfilter - diff --git a/pkg/sentry/state/state_state_autogen.go b/pkg/sentry/state/state_state_autogen.go index 6c0d9b7a7..6c2b29632 100755 --- a/pkg/sentry/state/state_state_autogen.go +++ b/pkg/sentry/state/state_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package state - diff --git a/pkg/sentry/strace/strace_amd64_state_autogen.go b/pkg/sentry/strace/strace_amd64_state_autogen.go index 844e83b55..c7d4b3eb4 100755 --- a/pkg/sentry/strace/strace_amd64_state_autogen.go +++ b/pkg/sentry/strace/strace_amd64_state_autogen.go @@ -3,4 +3,3 @@ // +build amd64 package strace - diff --git a/pkg/sentry/strace/strace_arm64_state_autogen.go b/pkg/sentry/strace/strace_arm64_state_autogen.go index 6f61e1610..9b8f66dc9 100755 --- a/pkg/sentry/strace/strace_arm64_state_autogen.go +++ b/pkg/sentry/strace/strace_arm64_state_autogen.go @@ -3,4 +3,3 @@ // +build arm64 package strace - diff --git a/pkg/sentry/strace/strace_state_autogen.go b/pkg/sentry/strace/strace_state_autogen.go index 9dc697ed6..33f6a7a54 100755 --- a/pkg/sentry/strace/strace_state_autogen.go +++ b/pkg/sentry/strace/strace_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package strace - diff --git a/pkg/sentry/syscalls/linux/linux_amd64_state_autogen.go b/pkg/sentry/syscalls/linux/linux_amd64_state_autogen.go index db9570e4e..a98193a5b 100755 --- a/pkg/sentry/syscalls/linux/linux_amd64_state_autogen.go +++ b/pkg/sentry/syscalls/linux/linux_amd64_state_autogen.go @@ -4,4 +4,3 @@ // +build amd64 package linux - diff --git a/pkg/sentry/syscalls/linux/linux_arm64_state_autogen.go b/pkg/sentry/syscalls/linux/linux_arm64_state_autogen.go index d3a92b86f..b144adbda 100755 --- a/pkg/sentry/syscalls/linux/linux_arm64_state_autogen.go +++ b/pkg/sentry/syscalls/linux/linux_arm64_state_autogen.go @@ -4,4 +4,3 @@ // +build arm64 package linux - diff --git a/pkg/sentry/syscalls/linux/vfs2/vfs2_amd64_state_autogen.go b/pkg/sentry/syscalls/linux/vfs2/vfs2_amd64_state_autogen.go index b049dbca1..1ca38ac2e 100755 --- a/pkg/sentry/syscalls/linux/vfs2/vfs2_amd64_state_autogen.go +++ b/pkg/sentry/syscalls/linux/vfs2/vfs2_amd64_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package vfs2 - diff --git a/pkg/sentry/syscalls/linux/vfs2/vfs2_arm64_state_autogen.go b/pkg/sentry/syscalls/linux/vfs2/vfs2_arm64_state_autogen.go index b049dbca1..1ca38ac2e 100755 --- a/pkg/sentry/syscalls/linux/vfs2/vfs2_arm64_state_autogen.go +++ b/pkg/sentry/syscalls/linux/vfs2/vfs2_arm64_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package vfs2 - diff --git a/pkg/sentry/syscalls/linux/vfs2/vfs2_state_autogen.go b/pkg/sentry/syscalls/linux/vfs2/vfs2_state_autogen.go index b049dbca1..1ca38ac2e 100755 --- a/pkg/sentry/syscalls/linux/vfs2/vfs2_state_autogen.go +++ b/pkg/sentry/syscalls/linux/vfs2/vfs2_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package vfs2 - diff --git a/pkg/sentry/syscalls/syscalls_state_autogen.go b/pkg/sentry/syscalls/syscalls_state_autogen.go index c114e7989..b577e39a3 100755 --- a/pkg/sentry/syscalls/syscalls_state_autogen.go +++ b/pkg/sentry/syscalls/syscalls_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package syscalls - diff --git a/pkg/sentry/time/time_arm64_state_autogen.go b/pkg/sentry/time/time_arm64_state_autogen.go index ea614b056..2adc9c9e0 100755 --- a/pkg/sentry/time/time_arm64_state_autogen.go +++ b/pkg/sentry/time/time_arm64_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package time - diff --git a/pkg/sentry/time/time_state_autogen.go b/pkg/sentry/time/time_state_autogen.go index ea614b056..2adc9c9e0 100755 --- a/pkg/sentry/time/time_state_autogen.go +++ b/pkg/sentry/time/time_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package time - diff --git a/pkg/sentry/unimpl/unimpl_state_autogen.go b/pkg/sentry/unimpl/unimpl_state_autogen.go index b9d1116f3..b37d16f87 100755 --- a/pkg/sentry/unimpl/unimpl_state_autogen.go +++ b/pkg/sentry/unimpl/unimpl_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package unimpl - diff --git a/pkg/sentry/uniqueid/uniqueid_state_autogen.go b/pkg/sentry/uniqueid/uniqueid_state_autogen.go index 09e4327e4..1890fdf46 100755 --- a/pkg/sentry/uniqueid/uniqueid_state_autogen.go +++ b/pkg/sentry/uniqueid/uniqueid_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package uniqueid - diff --git a/pkg/sentry/watchdog/watchdog_state_autogen.go b/pkg/sentry/watchdog/watchdog_state_autogen.go index 530ac6a07..bce0200e7 100755 --- a/pkg/sentry/watchdog/watchdog_state_autogen.go +++ b/pkg/sentry/watchdog/watchdog_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package watchdog - diff --git a/pkg/sleep/sleep_state_autogen.go b/pkg/sleep/sleep_state_autogen.go index c3b9dd48e..e8727e1c9 100755 --- a/pkg/sleep/sleep_state_autogen.go +++ b/pkg/sleep/sleep_state_autogen.go @@ -7,4 +7,3 @@ // +build !go1.15 package sleep - diff --git a/pkg/state/statefile/statefile_state_autogen.go b/pkg/state/statefile/statefile_state_autogen.go index 438c485ca..a2cdaa3f1 100755 --- a/pkg/state/statefile/statefile_state_autogen.go +++ b/pkg/state/statefile/statefile_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package statefile - diff --git a/pkg/sync/sync_state_autogen.go b/pkg/sync/sync_state_autogen.go index 9073f4edb..7ce796ad8 100755 --- a/pkg/sync/sync_state_autogen.go +++ b/pkg/sync/sync_state_autogen.go @@ -10,4 +10,3 @@ // +build !go1.15 package sync - diff --git a/pkg/syserr/syserr_linux_state_autogen.go b/pkg/syserr/syserr_linux_state_autogen.go index 6650dfb44..7fd5a68b8 100755 --- a/pkg/syserr/syserr_linux_state_autogen.go +++ b/pkg/syserr/syserr_linux_state_autogen.go @@ -3,4 +3,3 @@ // +build linux package syserr - diff --git a/pkg/syserr/syserr_state_autogen.go b/pkg/syserr/syserr_state_autogen.go index f34cb096b..712631a64 100755 --- a/pkg/syserr/syserr_state_autogen.go +++ b/pkg/syserr/syserr_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package syserr - diff --git a/pkg/syserror/syserror_state_autogen.go b/pkg/syserror/syserror_state_autogen.go index 5691e4f5e..456dcf093 100755 --- a/pkg/syserror/syserror_state_autogen.go +++ b/pkg/syserror/syserror_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package syserror - diff --git a/pkg/tcpip/adapters/gonet/gonet_state_autogen.go b/pkg/tcpip/adapters/gonet/gonet_state_autogen.go index 9b87956fd..7a5c5419e 100755 --- a/pkg/tcpip/adapters/gonet/gonet_state_autogen.go +++ b/pkg/tcpip/adapters/gonet/gonet_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package gonet - diff --git a/pkg/tcpip/hash/jenkins/jenkins_state_autogen.go b/pkg/tcpip/hash/jenkins/jenkins_state_autogen.go index 310f0ee6d..216cc5a2e 100755 --- a/pkg/tcpip/hash/jenkins/jenkins_state_autogen.go +++ b/pkg/tcpip/hash/jenkins/jenkins_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package jenkins - diff --git a/pkg/tcpip/iptables/iptables_state_autogen.go b/pkg/tcpip/iptables/iptables_state_autogen.go index f15092db2..e75169fa7 100755 --- a/pkg/tcpip/iptables/iptables_state_autogen.go +++ b/pkg/tcpip/iptables/iptables_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package iptables - diff --git a/pkg/tcpip/link/channel/channel_state_autogen.go b/pkg/tcpip/link/channel/channel_state_autogen.go index 19e9e5a2b..24066fb83 100755 --- a/pkg/tcpip/link/channel/channel_state_autogen.go +++ b/pkg/tcpip/link/channel/channel_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package channel - diff --git a/pkg/tcpip/link/fdbased/fdbased_state_autogen.go b/pkg/tcpip/link/fdbased/fdbased_state_autogen.go index ddc29cce5..97cb3958e 100755 --- a/pkg/tcpip/link/fdbased/fdbased_state_autogen.go +++ b/pkg/tcpip/link/fdbased/fdbased_state_autogen.go @@ -8,4 +8,3 @@ // +build linux package fdbased - diff --git a/pkg/tcpip/link/loopback/loopback_state_autogen.go b/pkg/tcpip/link/loopback/loopback_state_autogen.go index 87ec8cfc7..c00fd9f19 100755 --- a/pkg/tcpip/link/loopback/loopback_state_autogen.go +++ b/pkg/tcpip/link/loopback/loopback_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package loopback - diff --git a/pkg/tcpip/link/muxed/muxed_state_autogen.go b/pkg/tcpip/link/muxed/muxed_state_autogen.go index e3330c0da..56330e2a5 100755 --- a/pkg/tcpip/link/muxed/muxed_state_autogen.go +++ b/pkg/tcpip/link/muxed/muxed_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package muxed - diff --git a/pkg/tcpip/link/rawfile/rawfile_state_autogen.go b/pkg/tcpip/link/rawfile/rawfile_state_autogen.go index 943c408c1..6b6816bae 100755 --- a/pkg/tcpip/link/rawfile/rawfile_state_autogen.go +++ b/pkg/tcpip/link/rawfile/rawfile_state_autogen.go @@ -8,4 +8,3 @@ // +build linux package rawfile - diff --git a/pkg/tcpip/link/sharedmem/pipe/pipe_state_autogen.go b/pkg/tcpip/link/sharedmem/pipe/pipe_state_autogen.go index c7c7c21b3..d3b40feb4 100755 --- a/pkg/tcpip/link/sharedmem/pipe/pipe_state_autogen.go +++ b/pkg/tcpip/link/sharedmem/pipe/pipe_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package pipe - diff --git a/pkg/tcpip/link/sharedmem/queue/queue_state_autogen.go b/pkg/tcpip/link/sharedmem/queue/queue_state_autogen.go index eec17d734..563d4fbb4 100755 --- a/pkg/tcpip/link/sharedmem/queue/queue_state_autogen.go +++ b/pkg/tcpip/link/sharedmem/queue/queue_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package queue - diff --git a/pkg/tcpip/link/sharedmem/sharedmem_state_autogen.go b/pkg/tcpip/link/sharedmem/sharedmem_state_autogen.go index f739a1d50..bc12017b2 100755 --- a/pkg/tcpip/link/sharedmem/sharedmem_state_autogen.go +++ b/pkg/tcpip/link/sharedmem/sharedmem_state_autogen.go @@ -4,4 +4,3 @@ // +build linux package sharedmem - diff --git a/pkg/tcpip/link/sniffer/sniffer_state_autogen.go b/pkg/tcpip/link/sniffer/sniffer_state_autogen.go index cfd84a739..8d79defea 100755 --- a/pkg/tcpip/link/sniffer/sniffer_state_autogen.go +++ b/pkg/tcpip/link/sniffer/sniffer_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package sniffer - diff --git a/pkg/tcpip/link/tun/tun_state_autogen.go b/pkg/tcpip/link/tun/tun_state_autogen.go index 277ed1b5f..149299ea3 100755 --- a/pkg/tcpip/link/tun/tun_state_autogen.go +++ b/pkg/tcpip/link/tun/tun_state_autogen.go @@ -3,4 +3,3 @@ // +build linux package tun - diff --git a/pkg/tcpip/link/waitable/waitable_state_autogen.go b/pkg/tcpip/link/waitable/waitable_state_autogen.go index 2029f4a1b..059424fa0 100755 --- a/pkg/tcpip/link/waitable/waitable_state_autogen.go +++ b/pkg/tcpip/link/waitable/waitable_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package waitable - diff --git a/pkg/tcpip/network/arp/arp_state_autogen.go b/pkg/tcpip/network/arp/arp_state_autogen.go index 14a21baff..5cd8535e3 100755 --- a/pkg/tcpip/network/arp/arp_state_autogen.go +++ b/pkg/tcpip/network/arp/arp_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package arp - diff --git a/pkg/tcpip/network/hash/hash_state_autogen.go b/pkg/tcpip/network/hash/hash_state_autogen.go index a3bcd4b69..9467fe298 100755 --- a/pkg/tcpip/network/hash/hash_state_autogen.go +++ b/pkg/tcpip/network/hash/hash_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package hash - diff --git a/pkg/tcpip/network/ipv4/ipv4_state_autogen.go b/pkg/tcpip/network/ipv4/ipv4_state_autogen.go index 6b2cc0142..250b2128e 100755 --- a/pkg/tcpip/network/ipv4/ipv4_state_autogen.go +++ b/pkg/tcpip/network/ipv4/ipv4_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package ipv4 - diff --git a/pkg/tcpip/network/ipv6/ipv6_state_autogen.go b/pkg/tcpip/network/ipv6/ipv6_state_autogen.go index 53319e0c4..40c67d440 100755 --- a/pkg/tcpip/network/ipv6/ipv6_state_autogen.go +++ b/pkg/tcpip/network/ipv6/ipv6_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package ipv6 - diff --git a/pkg/tcpip/seqnum/seqnum_state_autogen.go b/pkg/tcpip/seqnum/seqnum_state_autogen.go index bf76f6ac4..23e79811d 100755 --- a/pkg/tcpip/seqnum/seqnum_state_autogen.go +++ b/pkg/tcpip/seqnum/seqnum_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package seqnum - diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go index e4a6b1b8b..f2be0e651 100644 --- a/pkg/tcpip/transport/tcp/endpoint.go +++ b/pkg/tcpip/transport/tcp/endpoint.go @@ -2166,6 +2166,9 @@ func (e *endpoint) listen(backlog int) *tcpip.Error { e.isRegistered = true e.setEndpointState(StateListen) + // The channel may be non-nil when we're restoring the endpoint, and it + // may be pre-populated with some previously accepted (but not Accepted) + // endpoints. if e.acceptedChan == nil { e.acceptedChan = make(chan *endpoint, backlog) } diff --git a/pkg/tcpip/transport/tcpconntrack/tcpconntrack_state_autogen.go b/pkg/tcpip/transport/tcpconntrack/tcpconntrack_state_autogen.go index f3c60c272..ff53204da 100755 --- a/pkg/tcpip/transport/tcpconntrack/tcpconntrack_state_autogen.go +++ b/pkg/tcpip/transport/tcpconntrack/tcpconntrack_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package tcpconntrack - diff --git a/pkg/tmutex/tmutex_state_autogen.go b/pkg/tmutex/tmutex_state_autogen.go index 2b2bb599e..2336683e3 100755 --- a/pkg/tmutex/tmutex_state_autogen.go +++ b/pkg/tmutex/tmutex_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package tmutex - diff --git a/pkg/unet/unet_state_autogen.go b/pkg/unet/unet_state_autogen.go index 1f7c7fa59..9bbf31d35 100755 --- a/pkg/unet/unet_state_autogen.go +++ b/pkg/unet/unet_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package unet - diff --git a/pkg/urpc/urpc_state_autogen.go b/pkg/urpc/urpc_state_autogen.go index 01bf2172f..5fdca6717 100755 --- a/pkg/urpc/urpc_state_autogen.go +++ b/pkg/urpc/urpc_state_autogen.go @@ -1,4 +1,3 @@ // automatically generated by stateify. package urpc - diff --git a/pkg/usermem/usermem_arm64_state_autogen.go b/pkg/usermem/usermem_arm64_state_autogen.go index 969e0845e..d7c365e5d 100755 --- a/pkg/usermem/usermem_arm64_state_autogen.go +++ b/pkg/usermem/usermem_arm64_state_autogen.go @@ -3,4 +3,3 @@ // +build arm64 package usermem - diff --git a/pkg/waiter/waiter_state_autogen.go b/pkg/waiter/waiter_state_autogen.go index b73646808..88f4b1795 100755 --- a/pkg/waiter/waiter_state_autogen.go +++ b/pkg/waiter/waiter_state_autogen.go @@ -26,7 +26,9 @@ func (x *Entry) load(m state.Map) { func (x *Queue) beforeSave() {} func (x *Queue) save(m state.Map) { x.beforeSave() - if !state.IsZeroValue(x.list) { m.Failf("list is %v, expected zero", x.list) } + if !state.IsZeroValue(x.list) { + m.Failf("list is %v, expected zero", x.list) + } } func (x *Queue) afterLoad() {} |