diff options
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r-- | pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go | 15 | ||||
-rw-r--r-- | pkg/sentry/fs/fdpipe/pipe.go | 3 | ||||
-rw-r--r-- | pkg/sentry/fs/fs_state_autogen.go | 19 | ||||
-rw-r--r-- | pkg/sentry/fs/host/host_state_autogen.go | 14 | ||||
-rw-r--r-- | pkg/sentry/fs/host/inode.go | 2 | ||||
-rw-r--r-- | pkg/sentry/fs/inotify.go | 2 | ||||
-rw-r--r-- | pkg/sentry/fs/lock/lock.go | 2 | ||||
-rw-r--r-- | pkg/sentry/fs/lock/lock_state_autogen.go | 6 | ||||
-rw-r--r-- | pkg/sentry/fs/timerfd/timerfd.go | 2 | ||||
-rw-r--r-- | pkg/sentry/fs/timerfd/timerfd_state_autogen.go | 14 | ||||
-rw-r--r-- | pkg/sentry/fs/tty/line_discipline.go | 4 | ||||
-rw-r--r-- | pkg/sentry/fs/tty/tty_state_autogen.go | 12 |
12 files changed, 51 insertions, 44 deletions
diff --git a/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go b/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go index 68406ce66..247aba66b 100644 --- a/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go +++ b/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go @@ -13,6 +13,7 @@ func (p *pipeOperations) StateTypeName() string { func (p *pipeOperations) StateFields() []string { return []string{ + "Queue", "flags", "opener", "readAheadBuffer", @@ -24,16 +25,18 @@ func (p *pipeOperations) StateSave(stateSinkObject state.Sink) { p.beforeSave() var flagsValue fs.FileFlags flagsValue = p.saveFlags() - stateSinkObject.SaveValue(0, flagsValue) - stateSinkObject.Save(1, &p.opener) - stateSinkObject.Save(2, &p.readAheadBuffer) + stateSinkObject.SaveValue(1, flagsValue) + stateSinkObject.Save(0, &p.Queue) + stateSinkObject.Save(2, &p.opener) + stateSinkObject.Save(3, &p.readAheadBuffer) } // +checklocksignore func (p *pipeOperations) StateLoad(stateSourceObject state.Source) { - stateSourceObject.LoadWait(1, &p.opener) - stateSourceObject.Load(2, &p.readAheadBuffer) - stateSourceObject.LoadValue(0, new(fs.FileFlags), func(y interface{}) { p.loadFlags(y.(fs.FileFlags)) }) + stateSourceObject.Load(0, &p.Queue) + stateSourceObject.LoadWait(2, &p.opener) + stateSourceObject.Load(3, &p.readAheadBuffer) + stateSourceObject.LoadValue(1, new(fs.FileFlags), func(y interface{}) { p.loadFlags(y.(fs.FileFlags)) }) stateSourceObject.AfterLoad(p.afterLoad) } diff --git a/pkg/sentry/fs/fdpipe/pipe.go b/pkg/sentry/fs/fdpipe/pipe.go index 4370cce33..d2eb03bb7 100644 --- a/pkg/sentry/fs/fdpipe/pipe.go +++ b/pkg/sentry/fs/fdpipe/pipe.go @@ -45,7 +45,8 @@ type pipeOperations struct { fsutil.FileNoIoctl `state:"nosave"` fsutil.FileNoSplice `state:"nosave"` fsutil.FileUseInodeUnstableAttr `state:"nosave"` - waiter.Queue `state:"nosave"` + + waiter.Queue // flags are the flags used to open the pipe. flags fs.FileFlags `state:".(fs.FileFlags)"` diff --git a/pkg/sentry/fs/fs_state_autogen.go b/pkg/sentry/fs/fs_state_autogen.go index 62ab34d6f..22059a271 100644 --- a/pkg/sentry/fs/fs_state_autogen.go +++ b/pkg/sentry/fs/fs_state_autogen.go @@ -833,6 +833,7 @@ func (i *Inotify) StateTypeName() string { func (i *Inotify) StateFields() []string { return []string{ "id", + "Queue", "events", "scratch", "nextWatch", @@ -846,10 +847,11 @@ func (i *Inotify) beforeSave() {} func (i *Inotify) StateSave(stateSinkObject state.Sink) { i.beforeSave() stateSinkObject.Save(0, &i.id) - stateSinkObject.Save(1, &i.events) - stateSinkObject.Save(2, &i.scratch) - stateSinkObject.Save(3, &i.nextWatch) - stateSinkObject.Save(4, &i.watches) + stateSinkObject.Save(1, &i.Queue) + stateSinkObject.Save(2, &i.events) + stateSinkObject.Save(3, &i.scratch) + stateSinkObject.Save(4, &i.nextWatch) + stateSinkObject.Save(5, &i.watches) } func (i *Inotify) afterLoad() {} @@ -857,10 +859,11 @@ func (i *Inotify) afterLoad() {} // +checklocksignore func (i *Inotify) StateLoad(stateSourceObject state.Source) { stateSourceObject.Load(0, &i.id) - stateSourceObject.Load(1, &i.events) - stateSourceObject.Load(2, &i.scratch) - stateSourceObject.Load(3, &i.nextWatch) - stateSourceObject.Load(4, &i.watches) + stateSourceObject.Load(1, &i.Queue) + stateSourceObject.Load(2, &i.events) + stateSourceObject.Load(3, &i.scratch) + stateSourceObject.Load(4, &i.nextWatch) + stateSourceObject.Load(5, &i.watches) } func (e *Event) StateTypeName() string { diff --git a/pkg/sentry/fs/host/host_state_autogen.go b/pkg/sentry/fs/host/host_state_autogen.go index b06247919..50869fd79 100644 --- a/pkg/sentry/fs/host/host_state_autogen.go +++ b/pkg/sentry/fs/host/host_state_autogen.go @@ -115,6 +115,7 @@ func (i *inodeFileState) StateTypeName() string { func (i *inodeFileState) StateFields() []string { return []string{ "descriptor", + "queue", "sattr", "savedUAttr", } @@ -125,19 +126,18 @@ func (i *inodeFileState) beforeSave() {} // +checklocksignore func (i *inodeFileState) StateSave(stateSinkObject state.Sink) { i.beforeSave() - if !state.IsZeroValue(&i.queue) { - state.Failf("queue is %#v, expected zero", &i.queue) - } stateSinkObject.Save(0, &i.descriptor) - stateSinkObject.Save(1, &i.sattr) - stateSinkObject.Save(2, &i.savedUAttr) + stateSinkObject.Save(1, &i.queue) + stateSinkObject.Save(2, &i.sattr) + stateSinkObject.Save(3, &i.savedUAttr) } // +checklocksignore func (i *inodeFileState) StateLoad(stateSourceObject state.Source) { stateSourceObject.LoadWait(0, &i.descriptor) - stateSourceObject.LoadWait(1, &i.sattr) - stateSourceObject.Load(2, &i.savedUAttr) + stateSourceObject.Load(1, &i.queue) + stateSourceObject.LoadWait(2, &i.sattr) + stateSourceObject.Load(3, &i.savedUAttr) stateSourceObject.AfterLoad(i.afterLoad) } diff --git a/pkg/sentry/fs/host/inode.go b/pkg/sentry/fs/host/inode.go index 92d58e3e9..99c37291e 100644 --- a/pkg/sentry/fs/host/inode.go +++ b/pkg/sentry/fs/host/inode.go @@ -70,7 +70,7 @@ type inodeFileState struct { descriptor *descriptor `state:"wait"` // Event queue for blocking operations. - queue waiter.Queue `state:"zerovalue"` + queue waiter.Queue // sattr is used to restore the inodeOperations. sattr fs.StableAttr `state:"wait"` diff --git a/pkg/sentry/fs/inotify.go b/pkg/sentry/fs/inotify.go index 51cd6cd37..941f37116 100644 --- a/pkg/sentry/fs/inotify.go +++ b/pkg/sentry/fs/inotify.go @@ -43,7 +43,7 @@ type Inotify struct { // user, since we may aggressively reuse an id on S/R. id uint64 - waiter.Queue `state:"nosave"` + waiter.Queue // evMu *only* protects the events list. We need a separate lock because // while queuing events, a watch needs to lock the event queue, and using mu diff --git a/pkg/sentry/fs/lock/lock.go b/pkg/sentry/fs/lock/lock.go index 7d7a207cc..e39d340fe 100644 --- a/pkg/sentry/fs/lock/lock.go +++ b/pkg/sentry/fs/lock/lock.go @@ -132,7 +132,7 @@ type Locks struct { locks LockSet // blockedQueue is the queue of waiters that are waiting on a lock. - blockedQueue waiter.Queue `state:"zerovalue"` + blockedQueue waiter.Queue } // Blocker is the interface used for blocking locks. Passing a nil Blocker diff --git a/pkg/sentry/fs/lock/lock_state_autogen.go b/pkg/sentry/fs/lock/lock_state_autogen.go index 4a9d0a1d8..8ddb3795c 100644 --- a/pkg/sentry/fs/lock/lock_state_autogen.go +++ b/pkg/sentry/fs/lock/lock_state_autogen.go @@ -69,6 +69,7 @@ func (l *Locks) StateTypeName() string { func (l *Locks) StateFields() []string { return []string{ "locks", + "blockedQueue", } } @@ -77,10 +78,8 @@ func (l *Locks) beforeSave() {} // +checklocksignore func (l *Locks) StateSave(stateSinkObject state.Sink) { l.beforeSave() - if !state.IsZeroValue(&l.blockedQueue) { - state.Failf("blockedQueue is %#v, expected zero", &l.blockedQueue) - } stateSinkObject.Save(0, &l.locks) + stateSinkObject.Save(1, &l.blockedQueue) } func (l *Locks) afterLoad() {} @@ -88,6 +87,7 @@ func (l *Locks) afterLoad() {} // +checklocksignore func (l *Locks) StateLoad(stateSourceObject state.Source) { stateSourceObject.Load(0, &l.locks) + stateSourceObject.Load(1, &l.blockedQueue) } func (r *LockRange) StateTypeName() string { diff --git a/pkg/sentry/fs/timerfd/timerfd.go b/pkg/sentry/fs/timerfd/timerfd.go index 1c8518d71..ca8be8683 100644 --- a/pkg/sentry/fs/timerfd/timerfd.go +++ b/pkg/sentry/fs/timerfd/timerfd.go @@ -43,7 +43,7 @@ type TimerOperations struct { fsutil.FileNoopFlush `state:"nosave"` fsutil.FileUseInodeUnstableAttr `state:"nosave"` - events waiter.Queue `state:"zerovalue"` + events waiter.Queue timer *ktime.Timer // val is the number of timer expirations since the last successful call to diff --git a/pkg/sentry/fs/timerfd/timerfd_state_autogen.go b/pkg/sentry/fs/timerfd/timerfd_state_autogen.go index 822eecdd6..6cab87796 100644 --- a/pkg/sentry/fs/timerfd/timerfd_state_autogen.go +++ b/pkg/sentry/fs/timerfd/timerfd_state_autogen.go @@ -12,6 +12,7 @@ func (t *TimerOperations) StateTypeName() string { func (t *TimerOperations) StateFields() []string { return []string{ + "events", "timer", "val", } @@ -22,19 +23,18 @@ func (t *TimerOperations) beforeSave() {} // +checklocksignore func (t *TimerOperations) StateSave(stateSinkObject state.Sink) { t.beforeSave() - if !state.IsZeroValue(&t.events) { - state.Failf("events is %#v, expected zero", &t.events) - } - stateSinkObject.Save(0, &t.timer) - stateSinkObject.Save(1, &t.val) + stateSinkObject.Save(0, &t.events) + stateSinkObject.Save(1, &t.timer) + stateSinkObject.Save(2, &t.val) } func (t *TimerOperations) afterLoad() {} // +checklocksignore func (t *TimerOperations) StateLoad(stateSourceObject state.Source) { - stateSourceObject.Load(0, &t.timer) - stateSourceObject.Load(1, &t.val) + stateSourceObject.Load(0, &t.events) + stateSourceObject.Load(1, &t.timer) + stateSourceObject.Load(2, &t.val) } func init() { diff --git a/pkg/sentry/fs/tty/line_discipline.go b/pkg/sentry/fs/tty/line_discipline.go index f9fca6d8e..f2c9e9668 100644 --- a/pkg/sentry/fs/tty/line_discipline.go +++ b/pkg/sentry/fs/tty/line_discipline.go @@ -102,10 +102,10 @@ type lineDiscipline struct { column int // masterWaiter is used to wait on the master end of the TTY. - masterWaiter waiter.Queue `state:"zerovalue"` + masterWaiter waiter.Queue // replicaWaiter is used to wait on the replica end of the TTY. - replicaWaiter waiter.Queue `state:"zerovalue"` + replicaWaiter waiter.Queue } func newLineDiscipline(termios linux.KernelTermios) *lineDiscipline { diff --git a/pkg/sentry/fs/tty/tty_state_autogen.go b/pkg/sentry/fs/tty/tty_state_autogen.go index 2fb0a8d27..1319a8d28 100644 --- a/pkg/sentry/fs/tty/tty_state_autogen.go +++ b/pkg/sentry/fs/tty/tty_state_autogen.go @@ -127,6 +127,8 @@ func (l *lineDiscipline) StateFields() []string { "outQueue", "termios", "column", + "masterWaiter", + "replicaWaiter", } } @@ -135,17 +137,13 @@ func (l *lineDiscipline) beforeSave() {} // +checklocksignore func (l *lineDiscipline) StateSave(stateSinkObject state.Sink) { l.beforeSave() - if !state.IsZeroValue(&l.masterWaiter) { - state.Failf("masterWaiter is %#v, expected zero", &l.masterWaiter) - } - if !state.IsZeroValue(&l.replicaWaiter) { - state.Failf("replicaWaiter is %#v, expected zero", &l.replicaWaiter) - } stateSinkObject.Save(0, &l.size) stateSinkObject.Save(1, &l.inQueue) stateSinkObject.Save(2, &l.outQueue) stateSinkObject.Save(3, &l.termios) stateSinkObject.Save(4, &l.column) + stateSinkObject.Save(5, &l.masterWaiter) + stateSinkObject.Save(6, &l.replicaWaiter) } func (l *lineDiscipline) afterLoad() {} @@ -157,6 +155,8 @@ func (l *lineDiscipline) StateLoad(stateSourceObject state.Source) { stateSourceObject.Load(2, &l.outQueue) stateSourceObject.Load(3, &l.termios) stateSourceObject.Load(4, &l.column) + stateSourceObject.Load(5, &l.masterWaiter) + stateSourceObject.Load(6, &l.replicaWaiter) } func (o *outputQueueTransformer) StateTypeName() string { |