diff options
Diffstat (limited to 'pkg/sentry')
83 files changed, 10474 insertions, 4256 deletions
diff --git a/pkg/sentry/arch/arch_amd64_state_autogen.go b/pkg/sentry/arch/arch_amd64_state_autogen.go index 73c523c90..a6afbbb53 100644 --- a/pkg/sentry/arch/arch_amd64_state_autogen.go +++ b/pkg/sentry/arch/arch_amd64_state_autogen.go @@ -10,19 +10,32 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *context64) StateTypeName() string { + return "pkg/sentry/arch.context64" +} + +func (x *context64) StateFields() []string { + return []string{ + "State", + "sigFPState", + } +} + func (x *context64) beforeSave() {} -func (x *context64) save(m state.Map) { + +func (x *context64) StateSave(m state.Sink) { x.beforeSave() - m.Save("State", &x.State) - m.Save("sigFPState", &x.sigFPState) + m.Save(0, &x.State) + m.Save(1, &x.sigFPState) } func (x *context64) afterLoad() {} -func (x *context64) load(m state.Map) { - m.Load("State", &x.State) - m.Load("sigFPState", &x.sigFPState) + +func (x *context64) StateLoad(m state.Source) { + m.Load(0, &x.State) + m.Load(1, &x.sigFPState) } func init() { - state.Register("pkg/sentry/arch.context64", (*context64)(nil), state.Fns{Save: (*context64).save, Load: (*context64).load}) + state.Register((*context64)(nil)) } diff --git a/pkg/sentry/arch/arch_state_autogen.go b/pkg/sentry/arch/arch_state_autogen.go index 82f4d9d73..b29124813 100644 --- a/pkg/sentry/arch/arch_state_autogen.go +++ b/pkg/sentry/arch/arch_state_autogen.go @@ -8,93 +8,167 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *MmapLayout) StateTypeName() string { + return "pkg/sentry/arch.MmapLayout" +} + +func (x *MmapLayout) StateFields() []string { + return []string{ + "MinAddr", + "MaxAddr", + "BottomUpBase", + "TopDownBase", + "DefaultDirection", + "MaxStackRand", + } +} + func (x *MmapLayout) beforeSave() {} -func (x *MmapLayout) save(m state.Map) { + +func (x *MmapLayout) StateSave(m state.Sink) { x.beforeSave() - m.Save("MinAddr", &x.MinAddr) - m.Save("MaxAddr", &x.MaxAddr) - m.Save("BottomUpBase", &x.BottomUpBase) - m.Save("TopDownBase", &x.TopDownBase) - m.Save("DefaultDirection", &x.DefaultDirection) - m.Save("MaxStackRand", &x.MaxStackRand) + m.Save(0, &x.MinAddr) + m.Save(1, &x.MaxAddr) + m.Save(2, &x.BottomUpBase) + m.Save(3, &x.TopDownBase) + m.Save(4, &x.DefaultDirection) + m.Save(5, &x.MaxStackRand) } func (x *MmapLayout) afterLoad() {} -func (x *MmapLayout) load(m state.Map) { - m.Load("MinAddr", &x.MinAddr) - m.Load("MaxAddr", &x.MaxAddr) - m.Load("BottomUpBase", &x.BottomUpBase) - m.Load("TopDownBase", &x.TopDownBase) - m.Load("DefaultDirection", &x.DefaultDirection) - m.Load("MaxStackRand", &x.MaxStackRand) + +func (x *MmapLayout) StateLoad(m state.Source) { + m.Load(0, &x.MinAddr) + m.Load(1, &x.MaxAddr) + m.Load(2, &x.BottomUpBase) + m.Load(3, &x.TopDownBase) + m.Load(4, &x.DefaultDirection) + m.Load(5, &x.MaxStackRand) +} + +func (x *AuxEntry) StateTypeName() string { + return "pkg/sentry/arch.AuxEntry" +} + +func (x *AuxEntry) StateFields() []string { + return []string{ + "Key", + "Value", + } } func (x *AuxEntry) beforeSave() {} -func (x *AuxEntry) save(m state.Map) { + +func (x *AuxEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("Key", &x.Key) - m.Save("Value", &x.Value) + m.Save(0, &x.Key) + m.Save(1, &x.Value) } func (x *AuxEntry) afterLoad() {} -func (x *AuxEntry) load(m state.Map) { - m.Load("Key", &x.Key) - m.Load("Value", &x.Value) + +func (x *AuxEntry) StateLoad(m state.Source) { + m.Load(0, &x.Key) + m.Load(1, &x.Value) +} + +func (x *SignalAct) StateTypeName() string { + return "pkg/sentry/arch.SignalAct" +} + +func (x *SignalAct) StateFields() []string { + return []string{ + "Handler", + "Flags", + "Restorer", + "Mask", + } } func (x *SignalAct) beforeSave() {} -func (x *SignalAct) save(m state.Map) { + +func (x *SignalAct) StateSave(m state.Sink) { x.beforeSave() - m.Save("Handler", &x.Handler) - m.Save("Flags", &x.Flags) - m.Save("Restorer", &x.Restorer) - m.Save("Mask", &x.Mask) + m.Save(0, &x.Handler) + m.Save(1, &x.Flags) + m.Save(2, &x.Restorer) + m.Save(3, &x.Mask) } func (x *SignalAct) afterLoad() {} -func (x *SignalAct) load(m state.Map) { - m.Load("Handler", &x.Handler) - m.Load("Flags", &x.Flags) - m.Load("Restorer", &x.Restorer) - m.Load("Mask", &x.Mask) + +func (x *SignalAct) StateLoad(m state.Source) { + m.Load(0, &x.Handler) + m.Load(1, &x.Flags) + m.Load(2, &x.Restorer) + m.Load(3, &x.Mask) +} + +func (x *SignalStack) StateTypeName() string { + return "pkg/sentry/arch.SignalStack" +} + +func (x *SignalStack) StateFields() []string { + return []string{ + "Addr", + "Flags", + "Size", + } } func (x *SignalStack) beforeSave() {} -func (x *SignalStack) save(m state.Map) { + +func (x *SignalStack) StateSave(m state.Sink) { x.beforeSave() - m.Save("Addr", &x.Addr) - m.Save("Flags", &x.Flags) - m.Save("Size", &x.Size) + m.Save(0, &x.Addr) + m.Save(1, &x.Flags) + m.Save(2, &x.Size) } func (x *SignalStack) afterLoad() {} -func (x *SignalStack) load(m state.Map) { - m.Load("Addr", &x.Addr) - m.Load("Flags", &x.Flags) - m.Load("Size", &x.Size) + +func (x *SignalStack) StateLoad(m state.Source) { + m.Load(0, &x.Addr) + m.Load(1, &x.Flags) + m.Load(2, &x.Size) +} + +func (x *SignalInfo) StateTypeName() string { + return "pkg/sentry/arch.SignalInfo" +} + +func (x *SignalInfo) StateFields() []string { + return []string{ + "Signo", + "Errno", + "Code", + "Fields", + } } func (x *SignalInfo) beforeSave() {} -func (x *SignalInfo) save(m state.Map) { + +func (x *SignalInfo) StateSave(m state.Sink) { x.beforeSave() - m.Save("Signo", &x.Signo) - m.Save("Errno", &x.Errno) - m.Save("Code", &x.Code) - m.Save("Fields", &x.Fields) + m.Save(0, &x.Signo) + m.Save(1, &x.Errno) + m.Save(2, &x.Code) + m.Save(3, &x.Fields) } func (x *SignalInfo) afterLoad() {} -func (x *SignalInfo) load(m state.Map) { - m.Load("Signo", &x.Signo) - m.Load("Errno", &x.Errno) - m.Load("Code", &x.Code) - m.Load("Fields", &x.Fields) + +func (x *SignalInfo) StateLoad(m state.Source) { + m.Load(0, &x.Signo) + m.Load(1, &x.Errno) + m.Load(2, &x.Code) + m.Load(3, &x.Fields) } func init() { - state.Register("pkg/sentry/arch.MmapLayout", (*MmapLayout)(nil), state.Fns{Save: (*MmapLayout).save, Load: (*MmapLayout).load}) - state.Register("pkg/sentry/arch.AuxEntry", (*AuxEntry)(nil), state.Fns{Save: (*AuxEntry).save, Load: (*AuxEntry).load}) - state.Register("pkg/sentry/arch.SignalAct", (*SignalAct)(nil), state.Fns{Save: (*SignalAct).save, Load: (*SignalAct).load}) - state.Register("pkg/sentry/arch.SignalStack", (*SignalStack)(nil), state.Fns{Save: (*SignalStack).save, Load: (*SignalStack).load}) - state.Register("pkg/sentry/arch.SignalInfo", (*SignalInfo)(nil), state.Fns{Save: (*SignalInfo).save, Load: (*SignalInfo).load}) + state.Register((*MmapLayout)(nil)) + state.Register((*AuxEntry)(nil)) + state.Register((*SignalAct)(nil)) + state.Register((*SignalStack)(nil)) + state.Register((*SignalInfo)(nil)) } diff --git a/pkg/sentry/arch/arch_x86_impl_state_autogen.go b/pkg/sentry/arch/arch_x86_impl_state_autogen.go index 7303bb17f..e7738a847 100644 --- a/pkg/sentry/arch/arch_x86_impl_state_autogen.go +++ b/pkg/sentry/arch/arch_x86_impl_state_autogen.go @@ -8,21 +8,34 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *State) StateTypeName() string { + return "pkg/sentry/arch.State" +} + +func (x *State) StateFields() []string { + return []string{ + "Regs", + "x86FPState", + "FeatureSet", + } +} + func (x *State) beforeSave() {} -func (x *State) save(m state.Map) { + +func (x *State) StateSave(m state.Sink) { x.beforeSave() - m.Save("Regs", &x.Regs) - m.Save("x86FPState", &x.x86FPState) - m.Save("FeatureSet", &x.FeatureSet) + m.Save(0, &x.Regs) + m.Save(1, &x.x86FPState) + m.Save(2, &x.FeatureSet) } -func (x *State) load(m state.Map) { - m.Load("Regs", &x.Regs) - m.LoadWait("x86FPState", &x.x86FPState) - m.Load("FeatureSet", &x.FeatureSet) +func (x *State) StateLoad(m state.Source) { + m.Load(0, &x.Regs) + m.LoadWait(1, &x.x86FPState) + m.Load(2, &x.FeatureSet) m.AfterLoad(x.afterLoad) } func init() { - state.Register("pkg/sentry/arch.State", (*State)(nil), state.Fns{Save: (*State).save, Load: (*State).load}) + state.Register((*State)(nil)) } diff --git a/pkg/sentry/device/device_state_autogen.go b/pkg/sentry/device/device_state_autogen.go index dd41a5659..8a28a4be4 100644 --- a/pkg/sentry/device/device_state_autogen.go +++ b/pkg/sentry/device/device_state_autogen.go @@ -6,47 +6,86 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Registry) StateTypeName() string { + return "pkg/sentry/device.Registry" +} + +func (x *Registry) StateFields() []string { + return []string{ + "lastAnonDeviceMinor", + "devices", + } +} + func (x *Registry) beforeSave() {} -func (x *Registry) save(m state.Map) { + +func (x *Registry) StateSave(m state.Sink) { x.beforeSave() - m.Save("lastAnonDeviceMinor", &x.lastAnonDeviceMinor) - m.Save("devices", &x.devices) + m.Save(0, &x.lastAnonDeviceMinor) + m.Save(1, &x.devices) } func (x *Registry) afterLoad() {} -func (x *Registry) load(m state.Map) { - m.Load("lastAnonDeviceMinor", &x.lastAnonDeviceMinor) - m.Load("devices", &x.devices) + +func (x *Registry) StateLoad(m state.Source) { + m.Load(0, &x.lastAnonDeviceMinor) + m.Load(1, &x.devices) +} + +func (x *ID) StateTypeName() string { + return "pkg/sentry/device.ID" +} + +func (x *ID) StateFields() []string { + return []string{ + "Major", + "Minor", + } } func (x *ID) beforeSave() {} -func (x *ID) save(m state.Map) { + +func (x *ID) StateSave(m state.Sink) { x.beforeSave() - m.Save("Major", &x.Major) - m.Save("Minor", &x.Minor) + m.Save(0, &x.Major) + m.Save(1, &x.Minor) } func (x *ID) afterLoad() {} -func (x *ID) load(m state.Map) { - m.Load("Major", &x.Major) - m.Load("Minor", &x.Minor) + +func (x *ID) StateLoad(m state.Source) { + m.Load(0, &x.Major) + m.Load(1, &x.Minor) +} + +func (x *Device) StateTypeName() string { + return "pkg/sentry/device.Device" +} + +func (x *Device) StateFields() []string { + return []string{ + "ID", + "last", + } } func (x *Device) beforeSave() {} -func (x *Device) save(m state.Map) { + +func (x *Device) StateSave(m state.Sink) { x.beforeSave() - m.Save("ID", &x.ID) - m.Save("last", &x.last) + m.Save(0, &x.ID) + m.Save(1, &x.last) } func (x *Device) afterLoad() {} -func (x *Device) load(m state.Map) { - m.Load("ID", &x.ID) - m.Load("last", &x.last) + +func (x *Device) StateLoad(m state.Source) { + m.Load(0, &x.ID) + m.Load(1, &x.last) } func init() { - state.Register("pkg/sentry/device.Registry", (*Registry)(nil), state.Fns{Save: (*Registry).save, Load: (*Registry).load}) - state.Register("pkg/sentry/device.ID", (*ID)(nil), state.Fns{Save: (*ID).save, Load: (*ID).load}) - state.Register("pkg/sentry/device.Device", (*Device)(nil), state.Fns{Save: (*Device).save, Load: (*Device).load}) + state.Register((*Registry)(nil)) + state.Register((*ID)(nil)) + state.Register((*Device)(nil)) } diff --git a/pkg/sentry/fs/dev/dev_state_autogen.go b/pkg/sentry/fs/dev/dev_state_autogen.go index 272f02672..48a60e45f 100644 --- a/pkg/sentry/fs/dev/dev_state_autogen.go +++ b/pkg/sentry/fs/dev/dev_state_autogen.go @@ -6,149 +6,293 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/dev.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} +} + func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *fullDevice) StateTypeName() string { + return "pkg/sentry/fs/dev.fullDevice" +} + +func (x *fullDevice) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *fullDevice) beforeSave() {} -func (x *fullDevice) save(m state.Map) { + +func (x *fullDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *fullDevice) afterLoad() {} -func (x *fullDevice) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *fullDevice) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *fullFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.fullFileOperations" +} + +func (x *fullFileOperations) StateFields() []string { + return []string{} } func (x *fullFileOperations) beforeSave() {} -func (x *fullFileOperations) save(m state.Map) { + +func (x *fullFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *fullFileOperations) afterLoad() {} -func (x *fullFileOperations) load(m state.Map) { + +func (x *fullFileOperations) StateLoad(m state.Source) { +} + +func (x *netTunInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.netTunInodeOperations" +} + +func (x *netTunInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *netTunInodeOperations) beforeSave() {} -func (x *netTunInodeOperations) save(m state.Map) { + +func (x *netTunInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *netTunInodeOperations) afterLoad() {} -func (x *netTunInodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *netTunInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *netTunFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.netTunFileOperations" +} + +func (x *netTunFileOperations) StateFields() []string { + return []string{ + "device", + } } func (x *netTunFileOperations) beforeSave() {} -func (x *netTunFileOperations) save(m state.Map) { + +func (x *netTunFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("device", &x.device) + m.Save(0, &x.device) } func (x *netTunFileOperations) afterLoad() {} -func (x *netTunFileOperations) load(m state.Map) { - m.Load("device", &x.device) + +func (x *netTunFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.device) +} + +func (x *nullDevice) StateTypeName() string { + return "pkg/sentry/fs/dev.nullDevice" +} + +func (x *nullDevice) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *nullDevice) beforeSave() {} -func (x *nullDevice) save(m state.Map) { + +func (x *nullDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *nullDevice) afterLoad() {} -func (x *nullDevice) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *nullDevice) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *nullFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.nullFileOperations" +} + +func (x *nullFileOperations) StateFields() []string { + return []string{} } func (x *nullFileOperations) beforeSave() {} -func (x *nullFileOperations) save(m state.Map) { + +func (x *nullFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *nullFileOperations) afterLoad() {} -func (x *nullFileOperations) load(m state.Map) { + +func (x *nullFileOperations) StateLoad(m state.Source) { +} + +func (x *zeroDevice) StateTypeName() string { + return "pkg/sentry/fs/dev.zeroDevice" +} + +func (x *zeroDevice) StateFields() []string { + return []string{ + "nullDevice", + } } func (x *zeroDevice) beforeSave() {} -func (x *zeroDevice) save(m state.Map) { + +func (x *zeroDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("nullDevice", &x.nullDevice) + m.Save(0, &x.nullDevice) } func (x *zeroDevice) afterLoad() {} -func (x *zeroDevice) load(m state.Map) { - m.Load("nullDevice", &x.nullDevice) + +func (x *zeroDevice) StateLoad(m state.Source) { + m.Load(0, &x.nullDevice) +} + +func (x *zeroFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.zeroFileOperations" +} + +func (x *zeroFileOperations) StateFields() []string { + return []string{} } func (x *zeroFileOperations) beforeSave() {} -func (x *zeroFileOperations) save(m state.Map) { + +func (x *zeroFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *zeroFileOperations) afterLoad() {} -func (x *zeroFileOperations) load(m state.Map) { + +func (x *zeroFileOperations) StateLoad(m state.Source) { +} + +func (x *randomDevice) StateTypeName() string { + return "pkg/sentry/fs/dev.randomDevice" +} + +func (x *randomDevice) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *randomDevice) beforeSave() {} -func (x *randomDevice) save(m state.Map) { + +func (x *randomDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *randomDevice) afterLoad() {} -func (x *randomDevice) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *randomDevice) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *randomFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.randomFileOperations" +} + +func (x *randomFileOperations) StateFields() []string { + return []string{} } func (x *randomFileOperations) beforeSave() {} -func (x *randomFileOperations) save(m state.Map) { + +func (x *randomFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *randomFileOperations) afterLoad() {} -func (x *randomFileOperations) load(m state.Map) { + +func (x *randomFileOperations) StateLoad(m state.Source) { +} + +func (x *ttyInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.ttyInodeOperations" +} + +func (x *ttyInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *ttyInodeOperations) beforeSave() {} -func (x *ttyInodeOperations) save(m state.Map) { + +func (x *ttyInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *ttyInodeOperations) afterLoad() {} -func (x *ttyInodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *ttyInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *ttyFileOperations) StateTypeName() string { + return "pkg/sentry/fs/dev.ttyFileOperations" +} + +func (x *ttyFileOperations) StateFields() []string { + return []string{} } func (x *ttyFileOperations) beforeSave() {} -func (x *ttyFileOperations) save(m state.Map) { + +func (x *ttyFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *ttyFileOperations) afterLoad() {} -func (x *ttyFileOperations) load(m state.Map) { + +func (x *ttyFileOperations) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/fs/dev.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/dev.fullDevice", (*fullDevice)(nil), state.Fns{Save: (*fullDevice).save, Load: (*fullDevice).load}) - state.Register("pkg/sentry/fs/dev.fullFileOperations", (*fullFileOperations)(nil), state.Fns{Save: (*fullFileOperations).save, Load: (*fullFileOperations).load}) - state.Register("pkg/sentry/fs/dev.netTunInodeOperations", (*netTunInodeOperations)(nil), state.Fns{Save: (*netTunInodeOperations).save, Load: (*netTunInodeOperations).load}) - state.Register("pkg/sentry/fs/dev.netTunFileOperations", (*netTunFileOperations)(nil), state.Fns{Save: (*netTunFileOperations).save, Load: (*netTunFileOperations).load}) - state.Register("pkg/sentry/fs/dev.nullDevice", (*nullDevice)(nil), state.Fns{Save: (*nullDevice).save, Load: (*nullDevice).load}) - state.Register("pkg/sentry/fs/dev.nullFileOperations", (*nullFileOperations)(nil), state.Fns{Save: (*nullFileOperations).save, Load: (*nullFileOperations).load}) - state.Register("pkg/sentry/fs/dev.zeroDevice", (*zeroDevice)(nil), state.Fns{Save: (*zeroDevice).save, Load: (*zeroDevice).load}) - state.Register("pkg/sentry/fs/dev.zeroFileOperations", (*zeroFileOperations)(nil), state.Fns{Save: (*zeroFileOperations).save, Load: (*zeroFileOperations).load}) - state.Register("pkg/sentry/fs/dev.randomDevice", (*randomDevice)(nil), state.Fns{Save: (*randomDevice).save, Load: (*randomDevice).load}) - state.Register("pkg/sentry/fs/dev.randomFileOperations", (*randomFileOperations)(nil), state.Fns{Save: (*randomFileOperations).save, Load: (*randomFileOperations).load}) - state.Register("pkg/sentry/fs/dev.ttyInodeOperations", (*ttyInodeOperations)(nil), state.Fns{Save: (*ttyInodeOperations).save, Load: (*ttyInodeOperations).load}) - state.Register("pkg/sentry/fs/dev.ttyFileOperations", (*ttyFileOperations)(nil), state.Fns{Save: (*ttyFileOperations).save, Load: (*ttyFileOperations).load}) + state.Register((*filesystem)(nil)) + state.Register((*fullDevice)(nil)) + state.Register((*fullFileOperations)(nil)) + state.Register((*netTunInodeOperations)(nil)) + state.Register((*netTunFileOperations)(nil)) + state.Register((*nullDevice)(nil)) + state.Register((*nullFileOperations)(nil)) + state.Register((*zeroDevice)(nil)) + state.Register((*zeroFileOperations)(nil)) + state.Register((*randomDevice)(nil)) + state.Register((*randomFileOperations)(nil)) + state.Register((*ttyInodeOperations)(nil)) + state.Register((*ttyFileOperations)(nil)) } diff --git a/pkg/sentry/fs/dirent_list.go b/pkg/sentry/fs/dirent_list.go index ecbbd7883..357ea925d 100644 --- a/pkg/sentry/fs/dirent_list.go +++ b/pkg/sentry/fs/dirent_list.go @@ -56,7 +56,7 @@ func (l *direntList) Back() *Dirent { // // NOTE: This is an O(n) operation. func (l *direntList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (direntElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *direntList) Remove(e *Dirent) { if prev != nil { direntElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { direntElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/fs/event_list.go b/pkg/sentry/fs/event_list.go index 167fdf906..277d8458e 100644 --- a/pkg/sentry/fs/event_list.go +++ b/pkg/sentry/fs/event_list.go @@ -56,7 +56,7 @@ func (l *eventList) Back() *Event { // // NOTE: This is an O(n) operation. func (l *eventList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (eventElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *eventList) Remove(e *Event) { if prev != nil { eventElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { eventElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go b/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go index 9ed7a3d41..359d52e92 100644 --- a/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go +++ b/pkg/sentry/fs/fdpipe/fdpipe_state_autogen.go @@ -7,21 +7,33 @@ import ( "gvisor.dev/gvisor/pkg/state" ) -func (x *pipeOperations) save(m state.Map) { +func (x *pipeOperations) StateTypeName() string { + return "pkg/sentry/fs/fdpipe.pipeOperations" +} + +func (x *pipeOperations) StateFields() []string { + return []string{ + "flags", + "opener", + "readAheadBuffer", + } +} + +func (x *pipeOperations) StateSave(m state.Sink) { x.beforeSave() var flags fs.FileFlags = x.saveFlags() - m.SaveValue("flags", flags) - m.Save("opener", &x.opener) - m.Save("readAheadBuffer", &x.readAheadBuffer) + m.SaveValue(0, flags) + m.Save(1, &x.opener) + m.Save(2, &x.readAheadBuffer) } -func (x *pipeOperations) load(m state.Map) { - m.LoadWait("opener", &x.opener) - m.Load("readAheadBuffer", &x.readAheadBuffer) - m.LoadValue("flags", new(fs.FileFlags), func(y interface{}) { x.loadFlags(y.(fs.FileFlags)) }) +func (x *pipeOperations) StateLoad(m state.Source) { + m.LoadWait(1, &x.opener) + m.Load(2, &x.readAheadBuffer) + m.LoadValue(0, new(fs.FileFlags), func(y interface{}) { x.loadFlags(y.(fs.FileFlags)) }) m.AfterLoad(x.afterLoad) } func init() { - state.Register("pkg/sentry/fs/fdpipe.pipeOperations", (*pipeOperations)(nil), state.Fns{Save: (*pipeOperations).save, Load: (*pipeOperations).load}) + state.Register((*pipeOperations)(nil)) } diff --git a/pkg/sentry/fs/fs_state_autogen.go b/pkg/sentry/fs/fs_state_autogen.go index 502a90d71..78e30e0e4 100644 --- a/pkg/sentry/fs/fs_state_autogen.go +++ b/pkg/sentry/fs/fs_state_autogen.go @@ -6,633 +6,1136 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *StableAttr) StateTypeName() string { + return "pkg/sentry/fs.StableAttr" +} + +func (x *StableAttr) StateFields() []string { + return []string{ + "Type", + "DeviceID", + "InodeID", + "BlockSize", + "DeviceFileMajor", + "DeviceFileMinor", + } +} + func (x *StableAttr) beforeSave() {} -func (x *StableAttr) save(m state.Map) { + +func (x *StableAttr) StateSave(m state.Sink) { x.beforeSave() - m.Save("Type", &x.Type) - m.Save("DeviceID", &x.DeviceID) - m.Save("InodeID", &x.InodeID) - m.Save("BlockSize", &x.BlockSize) - m.Save("DeviceFileMajor", &x.DeviceFileMajor) - m.Save("DeviceFileMinor", &x.DeviceFileMinor) + m.Save(0, &x.Type) + m.Save(1, &x.DeviceID) + m.Save(2, &x.InodeID) + m.Save(3, &x.BlockSize) + m.Save(4, &x.DeviceFileMajor) + m.Save(5, &x.DeviceFileMinor) } func (x *StableAttr) afterLoad() {} -func (x *StableAttr) load(m state.Map) { - m.Load("Type", &x.Type) - m.Load("DeviceID", &x.DeviceID) - m.Load("InodeID", &x.InodeID) - m.Load("BlockSize", &x.BlockSize) - m.Load("DeviceFileMajor", &x.DeviceFileMajor) - m.Load("DeviceFileMinor", &x.DeviceFileMinor) + +func (x *StableAttr) StateLoad(m state.Source) { + m.Load(0, &x.Type) + m.Load(1, &x.DeviceID) + m.Load(2, &x.InodeID) + m.Load(3, &x.BlockSize) + m.Load(4, &x.DeviceFileMajor) + m.Load(5, &x.DeviceFileMinor) +} + +func (x *UnstableAttr) StateTypeName() string { + return "pkg/sentry/fs.UnstableAttr" +} + +func (x *UnstableAttr) StateFields() []string { + return []string{ + "Size", + "Usage", + "Perms", + "Owner", + "AccessTime", + "ModificationTime", + "StatusChangeTime", + "Links", + } } func (x *UnstableAttr) beforeSave() {} -func (x *UnstableAttr) save(m state.Map) { + +func (x *UnstableAttr) StateSave(m state.Sink) { x.beforeSave() - m.Save("Size", &x.Size) - m.Save("Usage", &x.Usage) - m.Save("Perms", &x.Perms) - m.Save("Owner", &x.Owner) - m.Save("AccessTime", &x.AccessTime) - m.Save("ModificationTime", &x.ModificationTime) - m.Save("StatusChangeTime", &x.StatusChangeTime) - m.Save("Links", &x.Links) + m.Save(0, &x.Size) + m.Save(1, &x.Usage) + m.Save(2, &x.Perms) + m.Save(3, &x.Owner) + m.Save(4, &x.AccessTime) + m.Save(5, &x.ModificationTime) + m.Save(6, &x.StatusChangeTime) + m.Save(7, &x.Links) } func (x *UnstableAttr) afterLoad() {} -func (x *UnstableAttr) load(m state.Map) { - m.Load("Size", &x.Size) - m.Load("Usage", &x.Usage) - m.Load("Perms", &x.Perms) - m.Load("Owner", &x.Owner) - m.Load("AccessTime", &x.AccessTime) - m.Load("ModificationTime", &x.ModificationTime) - m.Load("StatusChangeTime", &x.StatusChangeTime) - m.Load("Links", &x.Links) + +func (x *UnstableAttr) StateLoad(m state.Source) { + m.Load(0, &x.Size) + m.Load(1, &x.Usage) + m.Load(2, &x.Perms) + m.Load(3, &x.Owner) + m.Load(4, &x.AccessTime) + m.Load(5, &x.ModificationTime) + m.Load(6, &x.StatusChangeTime) + m.Load(7, &x.Links) +} + +func (x *AttrMask) StateTypeName() string { + return "pkg/sentry/fs.AttrMask" +} + +func (x *AttrMask) StateFields() []string { + return []string{ + "Type", + "DeviceID", + "InodeID", + "BlockSize", + "Size", + "Usage", + "Perms", + "UID", + "GID", + "AccessTime", + "ModificationTime", + "StatusChangeTime", + "Links", + } } func (x *AttrMask) beforeSave() {} -func (x *AttrMask) save(m state.Map) { - x.beforeSave() - m.Save("Type", &x.Type) - m.Save("DeviceID", &x.DeviceID) - m.Save("InodeID", &x.InodeID) - m.Save("BlockSize", &x.BlockSize) - m.Save("Size", &x.Size) - m.Save("Usage", &x.Usage) - m.Save("Perms", &x.Perms) - m.Save("UID", &x.UID) - m.Save("GID", &x.GID) - m.Save("AccessTime", &x.AccessTime) - m.Save("ModificationTime", &x.ModificationTime) - m.Save("StatusChangeTime", &x.StatusChangeTime) - m.Save("Links", &x.Links) + +func (x *AttrMask) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.Type) + m.Save(1, &x.DeviceID) + m.Save(2, &x.InodeID) + m.Save(3, &x.BlockSize) + m.Save(4, &x.Size) + m.Save(5, &x.Usage) + m.Save(6, &x.Perms) + m.Save(7, &x.UID) + m.Save(8, &x.GID) + m.Save(9, &x.AccessTime) + m.Save(10, &x.ModificationTime) + m.Save(11, &x.StatusChangeTime) + m.Save(12, &x.Links) } func (x *AttrMask) afterLoad() {} -func (x *AttrMask) load(m state.Map) { - m.Load("Type", &x.Type) - m.Load("DeviceID", &x.DeviceID) - m.Load("InodeID", &x.InodeID) - m.Load("BlockSize", &x.BlockSize) - m.Load("Size", &x.Size) - m.Load("Usage", &x.Usage) - m.Load("Perms", &x.Perms) - m.Load("UID", &x.UID) - m.Load("GID", &x.GID) - m.Load("AccessTime", &x.AccessTime) - m.Load("ModificationTime", &x.ModificationTime) - m.Load("StatusChangeTime", &x.StatusChangeTime) - m.Load("Links", &x.Links) + +func (x *AttrMask) StateLoad(m state.Source) { + m.Load(0, &x.Type) + m.Load(1, &x.DeviceID) + m.Load(2, &x.InodeID) + m.Load(3, &x.BlockSize) + m.Load(4, &x.Size) + m.Load(5, &x.Usage) + m.Load(6, &x.Perms) + m.Load(7, &x.UID) + m.Load(8, &x.GID) + m.Load(9, &x.AccessTime) + m.Load(10, &x.ModificationTime) + m.Load(11, &x.StatusChangeTime) + m.Load(12, &x.Links) +} + +func (x *PermMask) StateTypeName() string { + return "pkg/sentry/fs.PermMask" +} + +func (x *PermMask) StateFields() []string { + return []string{ + "Read", + "Write", + "Execute", + } } func (x *PermMask) beforeSave() {} -func (x *PermMask) save(m state.Map) { + +func (x *PermMask) StateSave(m state.Sink) { x.beforeSave() - m.Save("Read", &x.Read) - m.Save("Write", &x.Write) - m.Save("Execute", &x.Execute) + m.Save(0, &x.Read) + m.Save(1, &x.Write) + m.Save(2, &x.Execute) } func (x *PermMask) afterLoad() {} -func (x *PermMask) load(m state.Map) { - m.Load("Read", &x.Read) - m.Load("Write", &x.Write) - m.Load("Execute", &x.Execute) + +func (x *PermMask) StateLoad(m state.Source) { + m.Load(0, &x.Read) + m.Load(1, &x.Write) + m.Load(2, &x.Execute) +} + +func (x *FilePermissions) StateTypeName() string { + return "pkg/sentry/fs.FilePermissions" +} + +func (x *FilePermissions) StateFields() []string { + return []string{ + "User", + "Group", + "Other", + "Sticky", + "SetUID", + "SetGID", + } } func (x *FilePermissions) beforeSave() {} -func (x *FilePermissions) save(m state.Map) { + +func (x *FilePermissions) StateSave(m state.Sink) { x.beforeSave() - m.Save("User", &x.User) - m.Save("Group", &x.Group) - m.Save("Other", &x.Other) - m.Save("Sticky", &x.Sticky) - m.Save("SetUID", &x.SetUID) - m.Save("SetGID", &x.SetGID) + m.Save(0, &x.User) + m.Save(1, &x.Group) + m.Save(2, &x.Other) + m.Save(3, &x.Sticky) + m.Save(4, &x.SetUID) + m.Save(5, &x.SetGID) } func (x *FilePermissions) afterLoad() {} -func (x *FilePermissions) load(m state.Map) { - m.Load("User", &x.User) - m.Load("Group", &x.Group) - m.Load("Other", &x.Other) - m.Load("Sticky", &x.Sticky) - m.Load("SetUID", &x.SetUID) - m.Load("SetGID", &x.SetGID) + +func (x *FilePermissions) StateLoad(m state.Source) { + m.Load(0, &x.User) + m.Load(1, &x.Group) + m.Load(2, &x.Other) + m.Load(3, &x.Sticky) + m.Load(4, &x.SetUID) + m.Load(5, &x.SetGID) +} + +func (x *FileOwner) StateTypeName() string { + return "pkg/sentry/fs.FileOwner" +} + +func (x *FileOwner) StateFields() []string { + return []string{ + "UID", + "GID", + } } func (x *FileOwner) beforeSave() {} -func (x *FileOwner) save(m state.Map) { + +func (x *FileOwner) StateSave(m state.Sink) { x.beforeSave() - m.Save("UID", &x.UID) - m.Save("GID", &x.GID) + m.Save(0, &x.UID) + m.Save(1, &x.GID) } func (x *FileOwner) afterLoad() {} -func (x *FileOwner) load(m state.Map) { - m.Load("UID", &x.UID) - m.Load("GID", &x.GID) + +func (x *FileOwner) StateLoad(m state.Source) { + m.Load(0, &x.UID) + m.Load(1, &x.GID) +} + +func (x *DentAttr) StateTypeName() string { + return "pkg/sentry/fs.DentAttr" +} + +func (x *DentAttr) StateFields() []string { + return []string{ + "Type", + "InodeID", + } } func (x *DentAttr) beforeSave() {} -func (x *DentAttr) save(m state.Map) { + +func (x *DentAttr) StateSave(m state.Sink) { x.beforeSave() - m.Save("Type", &x.Type) - m.Save("InodeID", &x.InodeID) + m.Save(0, &x.Type) + m.Save(1, &x.InodeID) } func (x *DentAttr) afterLoad() {} -func (x *DentAttr) load(m state.Map) { - m.Load("Type", &x.Type) - m.Load("InodeID", &x.InodeID) + +func (x *DentAttr) StateLoad(m state.Source) { + m.Load(0, &x.Type) + m.Load(1, &x.InodeID) +} + +func (x *SortedDentryMap) StateTypeName() string { + return "pkg/sentry/fs.SortedDentryMap" +} + +func (x *SortedDentryMap) StateFields() []string { + return []string{ + "names", + "entries", + } } func (x *SortedDentryMap) beforeSave() {} -func (x *SortedDentryMap) save(m state.Map) { + +func (x *SortedDentryMap) StateSave(m state.Sink) { x.beforeSave() - m.Save("names", &x.names) - m.Save("entries", &x.entries) + m.Save(0, &x.names) + m.Save(1, &x.entries) } func (x *SortedDentryMap) afterLoad() {} -func (x *SortedDentryMap) load(m state.Map) { - m.Load("names", &x.names) - m.Load("entries", &x.entries) + +func (x *SortedDentryMap) StateLoad(m state.Source) { + m.Load(0, &x.names) + m.Load(1, &x.entries) } -func (x *Dirent) save(m state.Map) { +func (x *Dirent) StateTypeName() string { + return "pkg/sentry/fs.Dirent" +} + +func (x *Dirent) StateFields() []string { + return []string{ + "AtomicRefCount", + "userVisible", + "Inode", + "name", + "parent", + "deleted", + "mounted", + "children", + } +} + +func (x *Dirent) StateSave(m state.Sink) { x.beforeSave() var children map[string]*Dirent = x.saveChildren() - m.SaveValue("children", children) - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("userVisible", &x.userVisible) - m.Save("Inode", &x.Inode) - m.Save("name", &x.name) - m.Save("parent", &x.parent) - m.Save("deleted", &x.deleted) - m.Save("mounted", &x.mounted) -} - -func (x *Dirent) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("userVisible", &x.userVisible) - m.Load("Inode", &x.Inode) - m.Load("name", &x.name) - m.Load("parent", &x.parent) - m.Load("deleted", &x.deleted) - m.Load("mounted", &x.mounted) - m.LoadValue("children", new(map[string]*Dirent), func(y interface{}) { x.loadChildren(y.(map[string]*Dirent)) }) + m.SaveValue(7, children) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.userVisible) + m.Save(2, &x.Inode) + m.Save(3, &x.name) + m.Save(4, &x.parent) + m.Save(5, &x.deleted) + m.Save(6, &x.mounted) +} + +func (x *Dirent) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.userVisible) + m.Load(2, &x.Inode) + m.Load(3, &x.name) + m.Load(4, &x.parent) + m.Load(5, &x.deleted) + m.Load(6, &x.mounted) + m.LoadValue(7, new(map[string]*Dirent), func(y interface{}) { x.loadChildren(y.(map[string]*Dirent)) }) m.AfterLoad(x.afterLoad) } +func (x *DirentCache) StateTypeName() string { + return "pkg/sentry/fs.DirentCache" +} + +func (x *DirentCache) StateFields() []string { + return []string{ + "maxSize", + "limit", + } +} + func (x *DirentCache) beforeSave() {} -func (x *DirentCache) save(m state.Map) { + +func (x *DirentCache) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.currentSize) { - m.Failf("currentSize is %#v, expected zero", &x.currentSize) + state.Failf("currentSize is %#v, expected zero", &x.currentSize) } if !state.IsZeroValue(&x.list) { - m.Failf("list is %#v, expected zero", &x.list) + state.Failf("list is %#v, expected zero", &x.list) } - m.Save("maxSize", &x.maxSize) - m.Save("limit", &x.limit) + m.Save(0, &x.maxSize) + m.Save(1, &x.limit) } func (x *DirentCache) afterLoad() {} -func (x *DirentCache) load(m state.Map) { - m.Load("maxSize", &x.maxSize) - m.Load("limit", &x.limit) + +func (x *DirentCache) StateLoad(m state.Source) { + m.Load(0, &x.maxSize) + m.Load(1, &x.limit) +} + +func (x *DirentCacheLimiter) StateTypeName() string { + return "pkg/sentry/fs.DirentCacheLimiter" +} + +func (x *DirentCacheLimiter) StateFields() []string { + return []string{ + "max", + } } func (x *DirentCacheLimiter) beforeSave() {} -func (x *DirentCacheLimiter) save(m state.Map) { + +func (x *DirentCacheLimiter) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.count) { - m.Failf("count is %#v, expected zero", &x.count) + state.Failf("count is %#v, expected zero", &x.count) } - m.Save("max", &x.max) + m.Save(0, &x.max) } func (x *DirentCacheLimiter) afterLoad() {} -func (x *DirentCacheLimiter) load(m state.Map) { - m.Load("max", &x.max) + +func (x *DirentCacheLimiter) StateLoad(m state.Source) { + m.Load(0, &x.max) +} + +func (x *direntList) StateTypeName() string { + return "pkg/sentry/fs.direntList" +} + +func (x *direntList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *direntList) beforeSave() {} -func (x *direntList) save(m state.Map) { + +func (x *direntList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *direntList) afterLoad() {} -func (x *direntList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *direntList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *direntEntry) StateTypeName() string { + return "pkg/sentry/fs.direntEntry" +} + +func (x *direntEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *direntEntry) beforeSave() {} -func (x *direntEntry) save(m state.Map) { + +func (x *direntEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *direntEntry) afterLoad() {} -func (x *direntEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *direntEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *eventList) StateTypeName() string { + return "pkg/sentry/fs.eventList" +} + +func (x *eventList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *eventList) beforeSave() {} -func (x *eventList) save(m state.Map) { + +func (x *eventList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *eventList) afterLoad() {} -func (x *eventList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *eventList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *eventEntry) StateTypeName() string { + return "pkg/sentry/fs.eventEntry" +} + +func (x *eventEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *eventEntry) beforeSave() {} -func (x *eventEntry) save(m state.Map) { + +func (x *eventEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *eventEntry) afterLoad() {} -func (x *eventEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) -} - -func (x *File) save(m state.Map) { - x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("UniqueID", &x.UniqueID) - m.Save("Dirent", &x.Dirent) - m.Save("flags", &x.flags) - m.Save("async", &x.async) - m.Save("FileOperations", &x.FileOperations) - m.Save("offset", &x.offset) -} - -func (x *File) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("UniqueID", &x.UniqueID) - m.Load("Dirent", &x.Dirent) - m.Load("flags", &x.flags) - m.Load("async", &x.async) - m.LoadWait("FileOperations", &x.FileOperations) - m.Load("offset", &x.offset) + +func (x *eventEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *File) StateTypeName() string { + return "pkg/sentry/fs.File" +} + +func (x *File) StateFields() []string { + return []string{ + "AtomicRefCount", + "UniqueID", + "Dirent", + "flags", + "async", + "FileOperations", + "offset", + } +} + +func (x *File) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.UniqueID) + m.Save(2, &x.Dirent) + m.Save(3, &x.flags) + m.Save(4, &x.async) + m.Save(5, &x.FileOperations) + m.Save(6, &x.offset) +} + +func (x *File) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.UniqueID) + m.Load(2, &x.Dirent) + m.Load(3, &x.flags) + m.Load(4, &x.async) + m.LoadWait(5, &x.FileOperations) + m.Load(6, &x.offset) m.AfterLoad(x.afterLoad) } +func (x *overlayFileOperations) StateTypeName() string { + return "pkg/sentry/fs.overlayFileOperations" +} + +func (x *overlayFileOperations) StateFields() []string { + return []string{ + "upper", + "lower", + "dirCursor", + } +} + func (x *overlayFileOperations) beforeSave() {} -func (x *overlayFileOperations) save(m state.Map) { + +func (x *overlayFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("upper", &x.upper) - m.Save("lower", &x.lower) - m.Save("dirCursor", &x.dirCursor) + m.Save(0, &x.upper) + m.Save(1, &x.lower) + m.Save(2, &x.dirCursor) } func (x *overlayFileOperations) afterLoad() {} -func (x *overlayFileOperations) load(m state.Map) { - m.Load("upper", &x.upper) - m.Load("lower", &x.lower) - m.Load("dirCursor", &x.dirCursor) + +func (x *overlayFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.upper) + m.Load(1, &x.lower) + m.Load(2, &x.dirCursor) +} + +func (x *overlayMappingIdentity) StateTypeName() string { + return "pkg/sentry/fs.overlayMappingIdentity" +} + +func (x *overlayMappingIdentity) StateFields() []string { + return []string{ + "AtomicRefCount", + "id", + "overlayFile", + } } func (x *overlayMappingIdentity) beforeSave() {} -func (x *overlayMappingIdentity) save(m state.Map) { + +func (x *overlayMappingIdentity) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("id", &x.id) - m.Save("overlayFile", &x.overlayFile) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.id) + m.Save(2, &x.overlayFile) } func (x *overlayMappingIdentity) afterLoad() {} -func (x *overlayMappingIdentity) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("id", &x.id) - m.Load("overlayFile", &x.overlayFile) + +func (x *overlayMappingIdentity) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.id) + m.Load(2, &x.overlayFile) +} + +func (x *MountSourceFlags) StateTypeName() string { + return "pkg/sentry/fs.MountSourceFlags" +} + +func (x *MountSourceFlags) StateFields() []string { + return []string{ + "ReadOnly", + "NoAtime", + "ForcePageCache", + "NoExec", + } } func (x *MountSourceFlags) beforeSave() {} -func (x *MountSourceFlags) save(m state.Map) { + +func (x *MountSourceFlags) StateSave(m state.Sink) { x.beforeSave() - m.Save("ReadOnly", &x.ReadOnly) - m.Save("NoAtime", &x.NoAtime) - m.Save("ForcePageCache", &x.ForcePageCache) - m.Save("NoExec", &x.NoExec) + m.Save(0, &x.ReadOnly) + m.Save(1, &x.NoAtime) + m.Save(2, &x.ForcePageCache) + m.Save(3, &x.NoExec) } func (x *MountSourceFlags) afterLoad() {} -func (x *MountSourceFlags) load(m state.Map) { - m.Load("ReadOnly", &x.ReadOnly) - m.Load("NoAtime", &x.NoAtime) - m.Load("ForcePageCache", &x.ForcePageCache) - m.Load("NoExec", &x.NoExec) + +func (x *MountSourceFlags) StateLoad(m state.Source) { + m.Load(0, &x.ReadOnly) + m.Load(1, &x.NoAtime) + m.Load(2, &x.ForcePageCache) + m.Load(3, &x.NoExec) +} + +func (x *FileFlags) StateTypeName() string { + return "pkg/sentry/fs.FileFlags" +} + +func (x *FileFlags) StateFields() []string { + return []string{ + "Direct", + "NonBlocking", + "DSync", + "Sync", + "Append", + "Read", + "Write", + "Pread", + "Pwrite", + "Directory", + "Async", + "LargeFile", + "NonSeekable", + "Truncate", + } } func (x *FileFlags) beforeSave() {} -func (x *FileFlags) save(m state.Map) { - x.beforeSave() - m.Save("Direct", &x.Direct) - m.Save("NonBlocking", &x.NonBlocking) - m.Save("DSync", &x.DSync) - m.Save("Sync", &x.Sync) - m.Save("Append", &x.Append) - m.Save("Read", &x.Read) - m.Save("Write", &x.Write) - m.Save("Pread", &x.Pread) - m.Save("Pwrite", &x.Pwrite) - m.Save("Directory", &x.Directory) - m.Save("Async", &x.Async) - m.Save("LargeFile", &x.LargeFile) - m.Save("NonSeekable", &x.NonSeekable) - m.Save("Truncate", &x.Truncate) + +func (x *FileFlags) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.Direct) + m.Save(1, &x.NonBlocking) + m.Save(2, &x.DSync) + m.Save(3, &x.Sync) + m.Save(4, &x.Append) + m.Save(5, &x.Read) + m.Save(6, &x.Write) + m.Save(7, &x.Pread) + m.Save(8, &x.Pwrite) + m.Save(9, &x.Directory) + m.Save(10, &x.Async) + m.Save(11, &x.LargeFile) + m.Save(12, &x.NonSeekable) + m.Save(13, &x.Truncate) } func (x *FileFlags) afterLoad() {} -func (x *FileFlags) load(m state.Map) { - m.Load("Direct", &x.Direct) - m.Load("NonBlocking", &x.NonBlocking) - m.Load("DSync", &x.DSync) - m.Load("Sync", &x.Sync) - m.Load("Append", &x.Append) - m.Load("Read", &x.Read) - m.Load("Write", &x.Write) - m.Load("Pread", &x.Pread) - m.Load("Pwrite", &x.Pwrite) - m.Load("Directory", &x.Directory) - m.Load("Async", &x.Async) - m.Load("LargeFile", &x.LargeFile) - m.Load("NonSeekable", &x.NonSeekable) - m.Load("Truncate", &x.Truncate) + +func (x *FileFlags) StateLoad(m state.Source) { + m.Load(0, &x.Direct) + m.Load(1, &x.NonBlocking) + m.Load(2, &x.DSync) + m.Load(3, &x.Sync) + m.Load(4, &x.Append) + m.Load(5, &x.Read) + m.Load(6, &x.Write) + m.Load(7, &x.Pread) + m.Load(8, &x.Pwrite) + m.Load(9, &x.Directory) + m.Load(10, &x.Async) + m.Load(11, &x.LargeFile) + m.Load(12, &x.NonSeekable) + m.Load(13, &x.Truncate) +} + +func (x *Inode) StateTypeName() string { + return "pkg/sentry/fs.Inode" +} + +func (x *Inode) StateFields() []string { + return []string{ + "AtomicRefCount", + "InodeOperations", + "StableAttr", + "LockCtx", + "Watches", + "MountSource", + "overlay", + } } func (x *Inode) beforeSave() {} -func (x *Inode) save(m state.Map) { + +func (x *Inode) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("InodeOperations", &x.InodeOperations) - m.Save("StableAttr", &x.StableAttr) - m.Save("LockCtx", &x.LockCtx) - m.Save("Watches", &x.Watches) - m.Save("MountSource", &x.MountSource) - m.Save("overlay", &x.overlay) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.InodeOperations) + m.Save(2, &x.StableAttr) + m.Save(3, &x.LockCtx) + m.Save(4, &x.Watches) + m.Save(5, &x.MountSource) + m.Save(6, &x.overlay) } func (x *Inode) afterLoad() {} -func (x *Inode) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("InodeOperations", &x.InodeOperations) - m.Load("StableAttr", &x.StableAttr) - m.Load("LockCtx", &x.LockCtx) - m.Load("Watches", &x.Watches) - m.Load("MountSource", &x.MountSource) - m.Load("overlay", &x.overlay) + +func (x *Inode) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.InodeOperations) + m.Load(2, &x.StableAttr) + m.Load(3, &x.LockCtx) + m.Load(4, &x.Watches) + m.Load(5, &x.MountSource) + m.Load(6, &x.overlay) +} + +func (x *LockCtx) StateTypeName() string { + return "pkg/sentry/fs.LockCtx" +} + +func (x *LockCtx) StateFields() []string { + return []string{ + "Posix", + "BSD", + } } func (x *LockCtx) beforeSave() {} -func (x *LockCtx) save(m state.Map) { + +func (x *LockCtx) StateSave(m state.Sink) { x.beforeSave() - m.Save("Posix", &x.Posix) - m.Save("BSD", &x.BSD) + m.Save(0, &x.Posix) + m.Save(1, &x.BSD) } func (x *LockCtx) afterLoad() {} -func (x *LockCtx) load(m state.Map) { - m.Load("Posix", &x.Posix) - m.Load("BSD", &x.BSD) + +func (x *LockCtx) StateLoad(m state.Source) { + m.Load(0, &x.Posix) + m.Load(1, &x.BSD) +} + +func (x *Watches) StateTypeName() string { + return "pkg/sentry/fs.Watches" +} + +func (x *Watches) StateFields() []string { + return []string{ + "ws", + "unlinked", + } } func (x *Watches) beforeSave() {} -func (x *Watches) save(m state.Map) { + +func (x *Watches) StateSave(m state.Sink) { x.beforeSave() - m.Save("ws", &x.ws) - m.Save("unlinked", &x.unlinked) + m.Save(0, &x.ws) + m.Save(1, &x.unlinked) } func (x *Watches) afterLoad() {} -func (x *Watches) load(m state.Map) { - m.Load("ws", &x.ws) - m.Load("unlinked", &x.unlinked) + +func (x *Watches) StateLoad(m state.Source) { + m.Load(0, &x.ws) + m.Load(1, &x.unlinked) +} + +func (x *Inotify) StateTypeName() string { + return "pkg/sentry/fs.Inotify" +} + +func (x *Inotify) StateFields() []string { + return []string{ + "id", + "events", + "scratch", + "nextWatch", + "watches", + } } func (x *Inotify) beforeSave() {} -func (x *Inotify) save(m state.Map) { + +func (x *Inotify) StateSave(m state.Sink) { x.beforeSave() - m.Save("id", &x.id) - m.Save("events", &x.events) - m.Save("scratch", &x.scratch) - m.Save("nextWatch", &x.nextWatch) - m.Save("watches", &x.watches) + m.Save(0, &x.id) + m.Save(1, &x.events) + m.Save(2, &x.scratch) + m.Save(3, &x.nextWatch) + m.Save(4, &x.watches) } func (x *Inotify) afterLoad() {} -func (x *Inotify) load(m state.Map) { - m.Load("id", &x.id) - m.Load("events", &x.events) - m.Load("scratch", &x.scratch) - m.Load("nextWatch", &x.nextWatch) - m.Load("watches", &x.watches) + +func (x *Inotify) StateLoad(m state.Source) { + m.Load(0, &x.id) + m.Load(1, &x.events) + m.Load(2, &x.scratch) + m.Load(3, &x.nextWatch) + m.Load(4, &x.watches) +} + +func (x *Event) StateTypeName() string { + return "pkg/sentry/fs.Event" +} + +func (x *Event) StateFields() []string { + return []string{ + "eventEntry", + "wd", + "mask", + "cookie", + "len", + "name", + } } func (x *Event) beforeSave() {} -func (x *Event) save(m state.Map) { + +func (x *Event) StateSave(m state.Sink) { x.beforeSave() - m.Save("eventEntry", &x.eventEntry) - m.Save("wd", &x.wd) - m.Save("mask", &x.mask) - m.Save("cookie", &x.cookie) - m.Save("len", &x.len) - m.Save("name", &x.name) + m.Save(0, &x.eventEntry) + m.Save(1, &x.wd) + m.Save(2, &x.mask) + m.Save(3, &x.cookie) + m.Save(4, &x.len) + m.Save(5, &x.name) } func (x *Event) afterLoad() {} -func (x *Event) load(m state.Map) { - m.Load("eventEntry", &x.eventEntry) - m.Load("wd", &x.wd) - m.Load("mask", &x.mask) - m.Load("cookie", &x.cookie) - m.Load("len", &x.len) - m.Load("name", &x.name) + +func (x *Event) StateLoad(m state.Source) { + m.Load(0, &x.eventEntry) + m.Load(1, &x.wd) + m.Load(2, &x.mask) + m.Load(3, &x.cookie) + m.Load(4, &x.len) + m.Load(5, &x.name) +} + +func (x *Watch) StateTypeName() string { + return "pkg/sentry/fs.Watch" +} + +func (x *Watch) StateFields() []string { + return []string{ + "owner", + "wd", + "target", + "unpinned", + "mask", + "pins", + } } func (x *Watch) beforeSave() {} -func (x *Watch) save(m state.Map) { + +func (x *Watch) StateSave(m state.Sink) { x.beforeSave() - m.Save("owner", &x.owner) - m.Save("wd", &x.wd) - m.Save("target", &x.target) - m.Save("unpinned", &x.unpinned) - m.Save("mask", &x.mask) - m.Save("pins", &x.pins) + m.Save(0, &x.owner) + m.Save(1, &x.wd) + m.Save(2, &x.target) + m.Save(3, &x.unpinned) + m.Save(4, &x.mask) + m.Save(5, &x.pins) } func (x *Watch) afterLoad() {} -func (x *Watch) load(m state.Map) { - m.Load("owner", &x.owner) - m.Load("wd", &x.wd) - m.Load("target", &x.target) - m.Load("unpinned", &x.unpinned) - m.Load("mask", &x.mask) - m.Load("pins", &x.pins) + +func (x *Watch) StateLoad(m state.Source) { + m.Load(0, &x.owner) + m.Load(1, &x.wd) + m.Load(2, &x.target) + m.Load(3, &x.unpinned) + m.Load(4, &x.mask) + m.Load(5, &x.pins) +} + +func (x *MountSource) StateTypeName() string { + return "pkg/sentry/fs.MountSource" +} + +func (x *MountSource) StateFields() []string { + return []string{ + "AtomicRefCount", + "MountSourceOperations", + "FilesystemType", + "Flags", + "fscache", + "direntRefs", + } } func (x *MountSource) beforeSave() {} -func (x *MountSource) save(m state.Map) { + +func (x *MountSource) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("MountSourceOperations", &x.MountSourceOperations) - m.Save("FilesystemType", &x.FilesystemType) - m.Save("Flags", &x.Flags) - m.Save("fscache", &x.fscache) - m.Save("direntRefs", &x.direntRefs) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.MountSourceOperations) + m.Save(2, &x.FilesystemType) + m.Save(3, &x.Flags) + m.Save(4, &x.fscache) + m.Save(5, &x.direntRefs) } func (x *MountSource) afterLoad() {} -func (x *MountSource) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("MountSourceOperations", &x.MountSourceOperations) - m.Load("FilesystemType", &x.FilesystemType) - m.Load("Flags", &x.Flags) - m.Load("fscache", &x.fscache) - m.Load("direntRefs", &x.direntRefs) + +func (x *MountSource) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.MountSourceOperations) + m.Load(2, &x.FilesystemType) + m.Load(3, &x.Flags) + m.Load(4, &x.fscache) + m.Load(5, &x.direntRefs) +} + +func (x *SimpleMountSourceOperations) StateTypeName() string { + return "pkg/sentry/fs.SimpleMountSourceOperations" +} + +func (x *SimpleMountSourceOperations) StateFields() []string { + return []string{ + "keep", + "revalidate", + "cacheReaddir", + } } func (x *SimpleMountSourceOperations) beforeSave() {} -func (x *SimpleMountSourceOperations) save(m state.Map) { + +func (x *SimpleMountSourceOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("keep", &x.keep) - m.Save("revalidate", &x.revalidate) - m.Save("cacheReaddir", &x.cacheReaddir) + m.Save(0, &x.keep) + m.Save(1, &x.revalidate) + m.Save(2, &x.cacheReaddir) } func (x *SimpleMountSourceOperations) afterLoad() {} -func (x *SimpleMountSourceOperations) load(m state.Map) { - m.Load("keep", &x.keep) - m.Load("revalidate", &x.revalidate) - m.Load("cacheReaddir", &x.cacheReaddir) + +func (x *SimpleMountSourceOperations) StateLoad(m state.Source) { + m.Load(0, &x.keep) + m.Load(1, &x.revalidate) + m.Load(2, &x.cacheReaddir) +} + +func (x *overlayMountSourceOperations) StateTypeName() string { + return "pkg/sentry/fs.overlayMountSourceOperations" +} + +func (x *overlayMountSourceOperations) StateFields() []string { + return []string{ + "upper", + "lower", + } } func (x *overlayMountSourceOperations) beforeSave() {} -func (x *overlayMountSourceOperations) save(m state.Map) { + +func (x *overlayMountSourceOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("upper", &x.upper) - m.Save("lower", &x.lower) + m.Save(0, &x.upper) + m.Save(1, &x.lower) } func (x *overlayMountSourceOperations) afterLoad() {} -func (x *overlayMountSourceOperations) load(m state.Map) { - m.Load("upper", &x.upper) - m.Load("lower", &x.lower) + +func (x *overlayMountSourceOperations) StateLoad(m state.Source) { + m.Load(0, &x.upper) + m.Load(1, &x.lower) +} + +func (x *overlayFilesystem) StateTypeName() string { + return "pkg/sentry/fs.overlayFilesystem" +} + +func (x *overlayFilesystem) StateFields() []string { + return []string{} } func (x *overlayFilesystem) beforeSave() {} -func (x *overlayFilesystem) save(m state.Map) { + +func (x *overlayFilesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *overlayFilesystem) afterLoad() {} -func (x *overlayFilesystem) load(m state.Map) { + +func (x *overlayFilesystem) StateLoad(m state.Source) { +} + +func (x *Mount) StateTypeName() string { + return "pkg/sentry/fs.Mount" +} + +func (x *Mount) StateFields() []string { + return []string{ + "ID", + "ParentID", + "root", + "previous", + } } func (x *Mount) beforeSave() {} -func (x *Mount) save(m state.Map) { + +func (x *Mount) StateSave(m state.Sink) { x.beforeSave() - m.Save("ID", &x.ID) - m.Save("ParentID", &x.ParentID) - m.Save("root", &x.root) - m.Save("previous", &x.previous) + m.Save(0, &x.ID) + m.Save(1, &x.ParentID) + m.Save(2, &x.root) + m.Save(3, &x.previous) } func (x *Mount) afterLoad() {} -func (x *Mount) load(m state.Map) { - m.Load("ID", &x.ID) - m.Load("ParentID", &x.ParentID) - m.Load("root", &x.root) - m.Load("previous", &x.previous) + +func (x *Mount) StateLoad(m state.Source) { + m.Load(0, &x.ID) + m.Load(1, &x.ParentID) + m.Load(2, &x.root) + m.Load(3, &x.previous) +} + +func (x *MountNamespace) StateTypeName() string { + return "pkg/sentry/fs.MountNamespace" +} + +func (x *MountNamespace) StateFields() []string { + return []string{ + "AtomicRefCount", + "userns", + "root", + "mounts", + "mountID", + } } func (x *MountNamespace) beforeSave() {} -func (x *MountNamespace) save(m state.Map) { + +func (x *MountNamespace) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("userns", &x.userns) - m.Save("root", &x.root) - m.Save("mounts", &x.mounts) - m.Save("mountID", &x.mountID) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.userns) + m.Save(2, &x.root) + m.Save(3, &x.mounts) + m.Save(4, &x.mountID) } func (x *MountNamespace) afterLoad() {} -func (x *MountNamespace) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("userns", &x.userns) - m.Load("root", &x.root) - m.Load("mounts", &x.mounts) - m.Load("mountID", &x.mountID) + +func (x *MountNamespace) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.userns) + m.Load(2, &x.root) + m.Load(3, &x.mounts) + m.Load(4, &x.mountID) +} + +func (x *overlayEntry) StateTypeName() string { + return "pkg/sentry/fs.overlayEntry" +} + +func (x *overlayEntry) StateFields() []string { + return []string{ + "lowerExists", + "lower", + "mappings", + "upper", + "dirCache", + } } func (x *overlayEntry) beforeSave() {} -func (x *overlayEntry) save(m state.Map) { + +func (x *overlayEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("lowerExists", &x.lowerExists) - m.Save("lower", &x.lower) - m.Save("mappings", &x.mappings) - m.Save("upper", &x.upper) - m.Save("dirCache", &x.dirCache) + m.Save(0, &x.lowerExists) + m.Save(1, &x.lower) + m.Save(2, &x.mappings) + m.Save(3, &x.upper) + m.Save(4, &x.dirCache) } func (x *overlayEntry) afterLoad() {} -func (x *overlayEntry) load(m state.Map) { - m.Load("lowerExists", &x.lowerExists) - m.Load("lower", &x.lower) - m.Load("mappings", &x.mappings) - m.Load("upper", &x.upper) - m.Load("dirCache", &x.dirCache) + +func (x *overlayEntry) StateLoad(m state.Source) { + m.Load(0, &x.lowerExists) + m.Load(1, &x.lower) + m.Load(2, &x.mappings) + m.Load(3, &x.upper) + m.Load(4, &x.dirCache) } func init() { - state.Register("pkg/sentry/fs.StableAttr", (*StableAttr)(nil), state.Fns{Save: (*StableAttr).save, Load: (*StableAttr).load}) - state.Register("pkg/sentry/fs.UnstableAttr", (*UnstableAttr)(nil), state.Fns{Save: (*UnstableAttr).save, Load: (*UnstableAttr).load}) - state.Register("pkg/sentry/fs.AttrMask", (*AttrMask)(nil), state.Fns{Save: (*AttrMask).save, Load: (*AttrMask).load}) - state.Register("pkg/sentry/fs.PermMask", (*PermMask)(nil), state.Fns{Save: (*PermMask).save, Load: (*PermMask).load}) - state.Register("pkg/sentry/fs.FilePermissions", (*FilePermissions)(nil), state.Fns{Save: (*FilePermissions).save, Load: (*FilePermissions).load}) - state.Register("pkg/sentry/fs.FileOwner", (*FileOwner)(nil), state.Fns{Save: (*FileOwner).save, Load: (*FileOwner).load}) - state.Register("pkg/sentry/fs.DentAttr", (*DentAttr)(nil), state.Fns{Save: (*DentAttr).save, Load: (*DentAttr).load}) - state.Register("pkg/sentry/fs.SortedDentryMap", (*SortedDentryMap)(nil), state.Fns{Save: (*SortedDentryMap).save, Load: (*SortedDentryMap).load}) - state.Register("pkg/sentry/fs.Dirent", (*Dirent)(nil), state.Fns{Save: (*Dirent).save, Load: (*Dirent).load}) - state.Register("pkg/sentry/fs.DirentCache", (*DirentCache)(nil), state.Fns{Save: (*DirentCache).save, Load: (*DirentCache).load}) - state.Register("pkg/sentry/fs.DirentCacheLimiter", (*DirentCacheLimiter)(nil), state.Fns{Save: (*DirentCacheLimiter).save, Load: (*DirentCacheLimiter).load}) - state.Register("pkg/sentry/fs.direntList", (*direntList)(nil), state.Fns{Save: (*direntList).save, Load: (*direntList).load}) - state.Register("pkg/sentry/fs.direntEntry", (*direntEntry)(nil), state.Fns{Save: (*direntEntry).save, Load: (*direntEntry).load}) - state.Register("pkg/sentry/fs.eventList", (*eventList)(nil), state.Fns{Save: (*eventList).save, Load: (*eventList).load}) - state.Register("pkg/sentry/fs.eventEntry", (*eventEntry)(nil), state.Fns{Save: (*eventEntry).save, Load: (*eventEntry).load}) - state.Register("pkg/sentry/fs.File", (*File)(nil), state.Fns{Save: (*File).save, Load: (*File).load}) - state.Register("pkg/sentry/fs.overlayFileOperations", (*overlayFileOperations)(nil), state.Fns{Save: (*overlayFileOperations).save, Load: (*overlayFileOperations).load}) - state.Register("pkg/sentry/fs.overlayMappingIdentity", (*overlayMappingIdentity)(nil), state.Fns{Save: (*overlayMappingIdentity).save, Load: (*overlayMappingIdentity).load}) - state.Register("pkg/sentry/fs.MountSourceFlags", (*MountSourceFlags)(nil), state.Fns{Save: (*MountSourceFlags).save, Load: (*MountSourceFlags).load}) - state.Register("pkg/sentry/fs.FileFlags", (*FileFlags)(nil), state.Fns{Save: (*FileFlags).save, Load: (*FileFlags).load}) - state.Register("pkg/sentry/fs.Inode", (*Inode)(nil), state.Fns{Save: (*Inode).save, Load: (*Inode).load}) - state.Register("pkg/sentry/fs.LockCtx", (*LockCtx)(nil), state.Fns{Save: (*LockCtx).save, Load: (*LockCtx).load}) - state.Register("pkg/sentry/fs.Watches", (*Watches)(nil), state.Fns{Save: (*Watches).save, Load: (*Watches).load}) - state.Register("pkg/sentry/fs.Inotify", (*Inotify)(nil), state.Fns{Save: (*Inotify).save, Load: (*Inotify).load}) - state.Register("pkg/sentry/fs.Event", (*Event)(nil), state.Fns{Save: (*Event).save, Load: (*Event).load}) - state.Register("pkg/sentry/fs.Watch", (*Watch)(nil), state.Fns{Save: (*Watch).save, Load: (*Watch).load}) - state.Register("pkg/sentry/fs.MountSource", (*MountSource)(nil), state.Fns{Save: (*MountSource).save, Load: (*MountSource).load}) - state.Register("pkg/sentry/fs.SimpleMountSourceOperations", (*SimpleMountSourceOperations)(nil), state.Fns{Save: (*SimpleMountSourceOperations).save, Load: (*SimpleMountSourceOperations).load}) - state.Register("pkg/sentry/fs.overlayMountSourceOperations", (*overlayMountSourceOperations)(nil), state.Fns{Save: (*overlayMountSourceOperations).save, Load: (*overlayMountSourceOperations).load}) - state.Register("pkg/sentry/fs.overlayFilesystem", (*overlayFilesystem)(nil), state.Fns{Save: (*overlayFilesystem).save, Load: (*overlayFilesystem).load}) - state.Register("pkg/sentry/fs.Mount", (*Mount)(nil), state.Fns{Save: (*Mount).save, Load: (*Mount).load}) - state.Register("pkg/sentry/fs.MountNamespace", (*MountNamespace)(nil), state.Fns{Save: (*MountNamespace).save, Load: (*MountNamespace).load}) - state.Register("pkg/sentry/fs.overlayEntry", (*overlayEntry)(nil), state.Fns{Save: (*overlayEntry).save, Load: (*overlayEntry).load}) + state.Register((*StableAttr)(nil)) + state.Register((*UnstableAttr)(nil)) + state.Register((*AttrMask)(nil)) + state.Register((*PermMask)(nil)) + state.Register((*FilePermissions)(nil)) + state.Register((*FileOwner)(nil)) + state.Register((*DentAttr)(nil)) + state.Register((*SortedDentryMap)(nil)) + state.Register((*Dirent)(nil)) + state.Register((*DirentCache)(nil)) + state.Register((*DirentCacheLimiter)(nil)) + state.Register((*direntList)(nil)) + state.Register((*direntEntry)(nil)) + state.Register((*eventList)(nil)) + state.Register((*eventEntry)(nil)) + state.Register((*File)(nil)) + state.Register((*overlayFileOperations)(nil)) + state.Register((*overlayMappingIdentity)(nil)) + state.Register((*MountSourceFlags)(nil)) + state.Register((*FileFlags)(nil)) + state.Register((*Inode)(nil)) + state.Register((*LockCtx)(nil)) + state.Register((*Watches)(nil)) + state.Register((*Inotify)(nil)) + state.Register((*Event)(nil)) + state.Register((*Watch)(nil)) + state.Register((*MountSource)(nil)) + state.Register((*SimpleMountSourceOperations)(nil)) + state.Register((*overlayMountSourceOperations)(nil)) + state.Register((*overlayFilesystem)(nil)) + state.Register((*Mount)(nil)) + state.Register((*MountNamespace)(nil)) + state.Register((*overlayEntry)(nil)) } diff --git a/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go b/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go index 79d4610f0..b3270d11d 100644 --- a/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go +++ b/pkg/sentry/fs/fsutil/fsutil_impl_state_autogen.go @@ -6,170 +6,305 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *DirtySet) StateTypeName() string { + return "pkg/sentry/fs/fsutil.DirtySet" +} + +func (x *DirtySet) StateFields() []string { + return []string{ + "root", + } +} + func (x *DirtySet) beforeSave() {} -func (x *DirtySet) save(m state.Map) { + +func (x *DirtySet) StateSave(m state.Sink) { x.beforeSave() var root *DirtySegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, 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 *DirtySet) StateLoad(m state.Source) { + m.LoadValue(0, new(*DirtySegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*DirtySegmentDataSlices)) }) +} + +func (x *Dirtynode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.Dirtynode" +} + +func (x *Dirtynode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *Dirtynode) beforeSave() {} -func (x *Dirtynode) save(m state.Map) { + +func (x *Dirtynode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *Dirtynode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *DirtySegmentDataSlices) StateTypeName() string { + return "pkg/sentry/fs/fsutil.DirtySegmentDataSlices" +} + +func (x *DirtySegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *DirtySegmentDataSlices) beforeSave() {} -func (x *DirtySegmentDataSlices) save(m state.Map) { + +func (x *DirtySegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &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 *DirtySegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *FileRangeSet) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FileRangeSet" +} + +func (x *FileRangeSet) StateFields() []string { + return []string{ + "root", + } } func (x *FileRangeSet) beforeSave() {} -func (x *FileRangeSet) save(m state.Map) { + +func (x *FileRangeSet) StateSave(m state.Sink) { x.beforeSave() var root *FileRangeSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, 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 *FileRangeSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*FileRangeSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FileRangeSegmentDataSlices)) }) +} + +func (x *FileRangenode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FileRangenode" +} + +func (x *FileRangenode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *FileRangenode) beforeSave() {} -func (x *FileRangenode) save(m state.Map) { + +func (x *FileRangenode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *FileRangenode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *FileRangeSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FileRangeSegmentDataSlices" +} + +func (x *FileRangeSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *FileRangeSegmentDataSlices) beforeSave() {} -func (x *FileRangeSegmentDataSlices) save(m state.Map) { + +func (x *FileRangeSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &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 *FileRangeSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *FrameRefSet) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FrameRefSet" +} + +func (x *FrameRefSet) StateFields() []string { + return []string{ + "root", + } } func (x *FrameRefSet) beforeSave() {} -func (x *FrameRefSet) save(m state.Map) { + +func (x *FrameRefSet) StateSave(m state.Sink) { x.beforeSave() var root *FrameRefSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, 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 *FrameRefSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*FrameRefSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*FrameRefSegmentDataSlices)) }) +} + +func (x *FrameRefnode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FrameRefnode" +} + +func (x *FrameRefnode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *FrameRefnode) beforeSave() {} -func (x *FrameRefnode) save(m state.Map) { + +func (x *FrameRefnode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *FrameRefnode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *FrameRefSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FrameRefSegmentDataSlices" +} + +func (x *FrameRefSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *FrameRefSegmentDataSlices) beforeSave() {} -func (x *FrameRefSegmentDataSlices) save(m state.Map) { + +func (x *FrameRefSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &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 *FrameRefSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) } func init() { - state.Register("pkg/sentry/fs/fsutil.DirtySet", (*DirtySet)(nil), state.Fns{Save: (*DirtySet).save, Load: (*DirtySet).load}) - state.Register("pkg/sentry/fs/fsutil.Dirtynode", (*Dirtynode)(nil), state.Fns{Save: (*Dirtynode).save, Load: (*Dirtynode).load}) - state.Register("pkg/sentry/fs/fsutil.DirtySegmentDataSlices", (*DirtySegmentDataSlices)(nil), state.Fns{Save: (*DirtySegmentDataSlices).save, Load: (*DirtySegmentDataSlices).load}) - state.Register("pkg/sentry/fs/fsutil.FileRangeSet", (*FileRangeSet)(nil), state.Fns{Save: (*FileRangeSet).save, Load: (*FileRangeSet).load}) - state.Register("pkg/sentry/fs/fsutil.FileRangenode", (*FileRangenode)(nil), state.Fns{Save: (*FileRangenode).save, Load: (*FileRangenode).load}) - state.Register("pkg/sentry/fs/fsutil.FileRangeSegmentDataSlices", (*FileRangeSegmentDataSlices)(nil), state.Fns{Save: (*FileRangeSegmentDataSlices).save, Load: (*FileRangeSegmentDataSlices).load}) - state.Register("pkg/sentry/fs/fsutil.FrameRefSet", (*FrameRefSet)(nil), state.Fns{Save: (*FrameRefSet).save, Load: (*FrameRefSet).load}) - state.Register("pkg/sentry/fs/fsutil.FrameRefnode", (*FrameRefnode)(nil), state.Fns{Save: (*FrameRefnode).save, Load: (*FrameRefnode).load}) - state.Register("pkg/sentry/fs/fsutil.FrameRefSegmentDataSlices", (*FrameRefSegmentDataSlices)(nil), state.Fns{Save: (*FrameRefSegmentDataSlices).save, Load: (*FrameRefSegmentDataSlices).load}) + state.Register((*DirtySet)(nil)) + state.Register((*Dirtynode)(nil)) + state.Register((*DirtySegmentDataSlices)(nil)) + state.Register((*FileRangeSet)(nil)) + state.Register((*FileRangenode)(nil)) + state.Register((*FileRangeSegmentDataSlices)(nil)) + state.Register((*FrameRefSet)(nil)) + state.Register((*FrameRefnode)(nil)) + state.Register((*FrameRefSegmentDataSlices)(nil)) } diff --git a/pkg/sentry/fs/fsutil/fsutil_state_autogen.go b/pkg/sentry/fs/fsutil/fsutil_state_autogen.go index 80b93ad25..8e2a4c961 100644 --- a/pkg/sentry/fs/fsutil/fsutil_state_autogen.go +++ b/pkg/sentry/fs/fsutil/fsutil_state_autogen.go @@ -6,199 +6,378 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *DirtyInfo) StateTypeName() string { + return "pkg/sentry/fs/fsutil.DirtyInfo" +} + +func (x *DirtyInfo) StateFields() []string { + return []string{ + "Keep", + } +} + func (x *DirtyInfo) beforeSave() {} -func (x *DirtyInfo) save(m state.Map) { + +func (x *DirtyInfo) StateSave(m state.Sink) { x.beforeSave() - m.Save("Keep", &x.Keep) + m.Save(0, &x.Keep) } func (x *DirtyInfo) afterLoad() {} -func (x *DirtyInfo) load(m state.Map) { - m.Load("Keep", &x.Keep) + +func (x *DirtyInfo) StateLoad(m state.Source) { + m.Load(0, &x.Keep) +} + +func (x *StaticDirFileOperations) StateTypeName() string { + return "pkg/sentry/fs/fsutil.StaticDirFileOperations" +} + +func (x *StaticDirFileOperations) StateFields() []string { + return []string{ + "dentryMap", + "dirCursor", + } } func (x *StaticDirFileOperations) beforeSave() {} -func (x *StaticDirFileOperations) save(m state.Map) { + +func (x *StaticDirFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("dentryMap", &x.dentryMap) - m.Save("dirCursor", &x.dirCursor) + m.Save(0, &x.dentryMap) + m.Save(1, &x.dirCursor) } func (x *StaticDirFileOperations) afterLoad() {} -func (x *StaticDirFileOperations) load(m state.Map) { - m.Load("dentryMap", &x.dentryMap) - m.Load("dirCursor", &x.dirCursor) + +func (x *StaticDirFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.dentryMap) + m.Load(1, &x.dirCursor) +} + +func (x *NoReadWriteFile) StateTypeName() string { + return "pkg/sentry/fs/fsutil.NoReadWriteFile" +} + +func (x *NoReadWriteFile) StateFields() []string { + return []string{} } func (x *NoReadWriteFile) beforeSave() {} -func (x *NoReadWriteFile) save(m state.Map) { + +func (x *NoReadWriteFile) StateSave(m state.Sink) { x.beforeSave() } func (x *NoReadWriteFile) afterLoad() {} -func (x *NoReadWriteFile) load(m state.Map) { + +func (x *NoReadWriteFile) StateLoad(m state.Source) { +} + +func (x *FileStaticContentReader) StateTypeName() string { + return "pkg/sentry/fs/fsutil.FileStaticContentReader" +} + +func (x *FileStaticContentReader) StateFields() []string { + return []string{ + "content", + } } func (x *FileStaticContentReader) beforeSave() {} -func (x *FileStaticContentReader) save(m state.Map) { + +func (x *FileStaticContentReader) StateSave(m state.Sink) { x.beforeSave() - m.Save("content", &x.content) + m.Save(0, &x.content) } func (x *FileStaticContentReader) afterLoad() {} -func (x *FileStaticContentReader) load(m state.Map) { - m.Load("content", &x.content) + +func (x *FileStaticContentReader) StateLoad(m state.Source) { + m.Load(0, &x.content) +} + +func (x *HostFileMapper) StateTypeName() string { + return "pkg/sentry/fs/fsutil.HostFileMapper" +} + +func (x *HostFileMapper) StateFields() []string { + return []string{ + "refs", + } } func (x *HostFileMapper) beforeSave() {} -func (x *HostFileMapper) save(m state.Map) { + +func (x *HostFileMapper) StateSave(m state.Sink) { x.beforeSave() - m.Save("refs", &x.refs) + m.Save(0, &x.refs) } -func (x *HostFileMapper) load(m state.Map) { - m.Load("refs", &x.refs) +func (x *HostFileMapper) StateLoad(m state.Source) { + m.Load(0, &x.refs) m.AfterLoad(x.afterLoad) } +func (x *HostMappable) StateTypeName() string { + return "pkg/sentry/fs/fsutil.HostMappable" +} + +func (x *HostMappable) StateFields() []string { + return []string{ + "hostFileMapper", + "backingFile", + "mappings", + } +} + func (x *HostMappable) beforeSave() {} -func (x *HostMappable) save(m state.Map) { + +func (x *HostMappable) StateSave(m state.Sink) { x.beforeSave() - m.Save("hostFileMapper", &x.hostFileMapper) - m.Save("backingFile", &x.backingFile) - m.Save("mappings", &x.mappings) + m.Save(0, &x.hostFileMapper) + m.Save(1, &x.backingFile) + m.Save(2, &x.mappings) } func (x *HostMappable) afterLoad() {} -func (x *HostMappable) load(m state.Map) { - m.Load("hostFileMapper", &x.hostFileMapper) - m.Load("backingFile", &x.backingFile) - m.Load("mappings", &x.mappings) + +func (x *HostMappable) StateLoad(m state.Source) { + m.Load(0, &x.hostFileMapper) + m.Load(1, &x.backingFile) + m.Load(2, &x.mappings) +} + +func (x *SimpleFileInode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.SimpleFileInode" +} + +func (x *SimpleFileInode) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *SimpleFileInode) beforeSave() {} -func (x *SimpleFileInode) save(m state.Map) { + +func (x *SimpleFileInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *SimpleFileInode) afterLoad() {} -func (x *SimpleFileInode) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *SimpleFileInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *NoReadWriteFileInode) StateTypeName() string { + return "pkg/sentry/fs/fsutil.NoReadWriteFileInode" +} + +func (x *NoReadWriteFileInode) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + } } func (x *NoReadWriteFileInode) beforeSave() {} -func (x *NoReadWriteFileInode) save(m state.Map) { + +func (x *NoReadWriteFileInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) + m.Save(0, &x.InodeSimpleAttributes) } func (x *NoReadWriteFileInode) afterLoad() {} -func (x *NoReadWriteFileInode) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) + +func (x *NoReadWriteFileInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) +} + +func (x *InodeSimpleAttributes) StateTypeName() string { + return "pkg/sentry/fs/fsutil.InodeSimpleAttributes" +} + +func (x *InodeSimpleAttributes) StateFields() []string { + return []string{ + "fsType", + "unstable", + } } func (x *InodeSimpleAttributes) beforeSave() {} -func (x *InodeSimpleAttributes) save(m state.Map) { + +func (x *InodeSimpleAttributes) StateSave(m state.Sink) { x.beforeSave() - m.Save("fsType", &x.fsType) - m.Save("unstable", &x.unstable) + m.Save(0, &x.fsType) + m.Save(1, &x.unstable) } func (x *InodeSimpleAttributes) afterLoad() {} -func (x *InodeSimpleAttributes) load(m state.Map) { - m.Load("fsType", &x.fsType) - m.Load("unstable", &x.unstable) + +func (x *InodeSimpleAttributes) StateLoad(m state.Source) { + m.Load(0, &x.fsType) + m.Load(1, &x.unstable) +} + +func (x *InodeSimpleExtendedAttributes) StateTypeName() string { + return "pkg/sentry/fs/fsutil.InodeSimpleExtendedAttributes" +} + +func (x *InodeSimpleExtendedAttributes) StateFields() []string { + return []string{ + "xattrs", + } } func (x *InodeSimpleExtendedAttributes) beforeSave() {} -func (x *InodeSimpleExtendedAttributes) save(m state.Map) { + +func (x *InodeSimpleExtendedAttributes) StateSave(m state.Sink) { x.beforeSave() - m.Save("xattrs", &x.xattrs) + m.Save(0, &x.xattrs) } func (x *InodeSimpleExtendedAttributes) afterLoad() {} -func (x *InodeSimpleExtendedAttributes) load(m state.Map) { - m.Load("xattrs", &x.xattrs) + +func (x *InodeSimpleExtendedAttributes) StateLoad(m state.Source) { + m.Load(0, &x.xattrs) +} + +func (x *staticFile) StateTypeName() string { + return "pkg/sentry/fs/fsutil.staticFile" +} + +func (x *staticFile) StateFields() []string { + return []string{ + "FileStaticContentReader", + } } func (x *staticFile) beforeSave() {} -func (x *staticFile) save(m state.Map) { + +func (x *staticFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("FileStaticContentReader", &x.FileStaticContentReader) + m.Save(0, &x.FileStaticContentReader) } func (x *staticFile) afterLoad() {} -func (x *staticFile) load(m state.Map) { - m.Load("FileStaticContentReader", &x.FileStaticContentReader) + +func (x *staticFile) StateLoad(m state.Source) { + m.Load(0, &x.FileStaticContentReader) +} + +func (x *InodeStaticFileGetter) StateTypeName() string { + return "pkg/sentry/fs/fsutil.InodeStaticFileGetter" +} + +func (x *InodeStaticFileGetter) StateFields() []string { + return []string{ + "Contents", + } } func (x *InodeStaticFileGetter) beforeSave() {} -func (x *InodeStaticFileGetter) save(m state.Map) { + +func (x *InodeStaticFileGetter) StateSave(m state.Sink) { x.beforeSave() - m.Save("Contents", &x.Contents) + m.Save(0, &x.Contents) } func (x *InodeStaticFileGetter) afterLoad() {} -func (x *InodeStaticFileGetter) load(m state.Map) { - m.Load("Contents", &x.Contents) + +func (x *InodeStaticFileGetter) StateLoad(m state.Source) { + m.Load(0, &x.Contents) +} + +func (x *CachingInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/fsutil.CachingInodeOperations" +} + +func (x *CachingInodeOperations) StateFields() []string { + return []string{ + "backingFile", + "mfp", + "opts", + "attr", + "dirtyAttr", + "mappings", + "cache", + "dirty", + "hostFileMapper", + "refs", + } } func (x *CachingInodeOperations) beforeSave() {} -func (x *CachingInodeOperations) save(m state.Map) { + +func (x *CachingInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("backingFile", &x.backingFile) - m.Save("mfp", &x.mfp) - m.Save("opts", &x.opts) - m.Save("attr", &x.attr) - m.Save("dirtyAttr", &x.dirtyAttr) - m.Save("mappings", &x.mappings) - m.Save("cache", &x.cache) - m.Save("dirty", &x.dirty) - m.Save("hostFileMapper", &x.hostFileMapper) - m.Save("refs", &x.refs) + m.Save(0, &x.backingFile) + m.Save(1, &x.mfp) + m.Save(2, &x.opts) + m.Save(3, &x.attr) + m.Save(4, &x.dirtyAttr) + m.Save(5, &x.mappings) + m.Save(6, &x.cache) + m.Save(7, &x.dirty) + m.Save(8, &x.hostFileMapper) + m.Save(9, &x.refs) } func (x *CachingInodeOperations) afterLoad() {} -func (x *CachingInodeOperations) load(m state.Map) { - m.Load("backingFile", &x.backingFile) - m.Load("mfp", &x.mfp) - m.Load("opts", &x.opts) - m.Load("attr", &x.attr) - m.Load("dirtyAttr", &x.dirtyAttr) - m.Load("mappings", &x.mappings) - m.Load("cache", &x.cache) - m.Load("dirty", &x.dirty) - m.Load("hostFileMapper", &x.hostFileMapper) - m.Load("refs", &x.refs) + +func (x *CachingInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.backingFile) + m.Load(1, &x.mfp) + m.Load(2, &x.opts) + m.Load(3, &x.attr) + m.Load(4, &x.dirtyAttr) + m.Load(5, &x.mappings) + m.Load(6, &x.cache) + m.Load(7, &x.dirty) + m.Load(8, &x.hostFileMapper) + m.Load(9, &x.refs) +} + +func (x *CachingInodeOperationsOptions) StateTypeName() string { + return "pkg/sentry/fs/fsutil.CachingInodeOperationsOptions" +} + +func (x *CachingInodeOperationsOptions) StateFields() []string { + return []string{ + "ForcePageCache", + "LimitHostFDTranslation", + } } func (x *CachingInodeOperationsOptions) beforeSave() {} -func (x *CachingInodeOperationsOptions) save(m state.Map) { + +func (x *CachingInodeOperationsOptions) StateSave(m state.Sink) { x.beforeSave() - m.Save("ForcePageCache", &x.ForcePageCache) - m.Save("LimitHostFDTranslation", &x.LimitHostFDTranslation) + m.Save(0, &x.ForcePageCache) + m.Save(1, &x.LimitHostFDTranslation) } func (x *CachingInodeOperationsOptions) afterLoad() {} -func (x *CachingInodeOperationsOptions) load(m state.Map) { - m.Load("ForcePageCache", &x.ForcePageCache) - m.Load("LimitHostFDTranslation", &x.LimitHostFDTranslation) + +func (x *CachingInodeOperationsOptions) StateLoad(m state.Source) { + m.Load(0, &x.ForcePageCache) + m.Load(1, &x.LimitHostFDTranslation) } func init() { - state.Register("pkg/sentry/fs/fsutil.DirtyInfo", (*DirtyInfo)(nil), state.Fns{Save: (*DirtyInfo).save, Load: (*DirtyInfo).load}) - state.Register("pkg/sentry/fs/fsutil.StaticDirFileOperations", (*StaticDirFileOperations)(nil), state.Fns{Save: (*StaticDirFileOperations).save, Load: (*StaticDirFileOperations).load}) - state.Register("pkg/sentry/fs/fsutil.NoReadWriteFile", (*NoReadWriteFile)(nil), state.Fns{Save: (*NoReadWriteFile).save, Load: (*NoReadWriteFile).load}) - state.Register("pkg/sentry/fs/fsutil.FileStaticContentReader", (*FileStaticContentReader)(nil), state.Fns{Save: (*FileStaticContentReader).save, Load: (*FileStaticContentReader).load}) - state.Register("pkg/sentry/fs/fsutil.HostFileMapper", (*HostFileMapper)(nil), state.Fns{Save: (*HostFileMapper).save, Load: (*HostFileMapper).load}) - state.Register("pkg/sentry/fs/fsutil.HostMappable", (*HostMappable)(nil), state.Fns{Save: (*HostMappable).save, Load: (*HostMappable).load}) - state.Register("pkg/sentry/fs/fsutil.SimpleFileInode", (*SimpleFileInode)(nil), state.Fns{Save: (*SimpleFileInode).save, Load: (*SimpleFileInode).load}) - state.Register("pkg/sentry/fs/fsutil.NoReadWriteFileInode", (*NoReadWriteFileInode)(nil), state.Fns{Save: (*NoReadWriteFileInode).save, Load: (*NoReadWriteFileInode).load}) - state.Register("pkg/sentry/fs/fsutil.InodeSimpleAttributes", (*InodeSimpleAttributes)(nil), state.Fns{Save: (*InodeSimpleAttributes).save, Load: (*InodeSimpleAttributes).load}) - state.Register("pkg/sentry/fs/fsutil.InodeSimpleExtendedAttributes", (*InodeSimpleExtendedAttributes)(nil), state.Fns{Save: (*InodeSimpleExtendedAttributes).save, Load: (*InodeSimpleExtendedAttributes).load}) - state.Register("pkg/sentry/fs/fsutil.staticFile", (*staticFile)(nil), state.Fns{Save: (*staticFile).save, Load: (*staticFile).load}) - state.Register("pkg/sentry/fs/fsutil.InodeStaticFileGetter", (*InodeStaticFileGetter)(nil), state.Fns{Save: (*InodeStaticFileGetter).save, Load: (*InodeStaticFileGetter).load}) - state.Register("pkg/sentry/fs/fsutil.CachingInodeOperations", (*CachingInodeOperations)(nil), state.Fns{Save: (*CachingInodeOperations).save, Load: (*CachingInodeOperations).load}) - state.Register("pkg/sentry/fs/fsutil.CachingInodeOperationsOptions", (*CachingInodeOperationsOptions)(nil), state.Fns{Save: (*CachingInodeOperationsOptions).save, Load: (*CachingInodeOperationsOptions).load}) + state.Register((*DirtyInfo)(nil)) + state.Register((*StaticDirFileOperations)(nil)) + state.Register((*NoReadWriteFile)(nil)) + state.Register((*FileStaticContentReader)(nil)) + state.Register((*HostFileMapper)(nil)) + state.Register((*HostMappable)(nil)) + state.Register((*SimpleFileInode)(nil)) + state.Register((*NoReadWriteFileInode)(nil)) + state.Register((*InodeSimpleAttributes)(nil)) + state.Register((*InodeSimpleExtendedAttributes)(nil)) + state.Register((*staticFile)(nil)) + state.Register((*InodeStaticFileGetter)(nil)) + state.Register((*CachingInodeOperations)(nil)) + state.Register((*CachingInodeOperationsOptions)(nil)) } diff --git a/pkg/sentry/fs/gofer/gofer_state_autogen.go b/pkg/sentry/fs/gofer/gofer_state_autogen.go index 7db9211b4..1f7360ec8 100644 --- a/pkg/sentry/fs/gofer/gofer_state_autogen.go +++ b/pkg/sentry/fs/gofer/gofer_state_autogen.go @@ -6,140 +6,250 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *fifo) StateTypeName() string { + return "pkg/sentry/fs/gofer.fifo" +} + +func (x *fifo) StateFields() []string { + return []string{ + "InodeOperations", + "fileIops", + } +} + func (x *fifo) beforeSave() {} -func (x *fifo) save(m state.Map) { + +func (x *fifo) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeOperations", &x.InodeOperations) - m.Save("fileIops", &x.fileIops) + m.Save(0, &x.InodeOperations) + m.Save(1, &x.fileIops) } func (x *fifo) afterLoad() {} -func (x *fifo) load(m state.Map) { - m.Load("InodeOperations", &x.InodeOperations) - m.Load("fileIops", &x.fileIops) + +func (x *fifo) StateLoad(m state.Source) { + m.Load(0, &x.InodeOperations) + m.Load(1, &x.fileIops) +} + +func (x *fileOperations) StateTypeName() string { + return "pkg/sentry/fs/gofer.fileOperations" +} + +func (x *fileOperations) StateFields() []string { + return []string{ + "inodeOperations", + "dirCursor", + "flags", + } } func (x *fileOperations) beforeSave() {} -func (x *fileOperations) save(m state.Map) { + +func (x *fileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("inodeOperations", &x.inodeOperations) - m.Save("dirCursor", &x.dirCursor) - m.Save("flags", &x.flags) + m.Save(0, &x.inodeOperations) + m.Save(1, &x.dirCursor) + m.Save(2, &x.flags) } -func (x *fileOperations) load(m state.Map) { - m.LoadWait("inodeOperations", &x.inodeOperations) - m.Load("dirCursor", &x.dirCursor) - m.LoadWait("flags", &x.flags) +func (x *fileOperations) StateLoad(m state.Source) { + m.LoadWait(0, &x.inodeOperations) + m.Load(1, &x.dirCursor) + m.LoadWait(2, &x.flags) m.AfterLoad(x.afterLoad) } +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/gofer.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} +} + func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *inodeOperations) StateTypeName() string { + return "pkg/sentry/fs/gofer.inodeOperations" +} + +func (x *inodeOperations) StateFields() []string { + return []string{ + "fileState", + "cachingInodeOps", + } } func (x *inodeOperations) beforeSave() {} -func (x *inodeOperations) save(m state.Map) { + +func (x *inodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("fileState", &x.fileState) - m.Save("cachingInodeOps", &x.cachingInodeOps) + m.Save(0, &x.fileState) + m.Save(1, &x.cachingInodeOps) } func (x *inodeOperations) afterLoad() {} -func (x *inodeOperations) load(m state.Map) { - m.LoadWait("fileState", &x.fileState) - m.Load("cachingInodeOps", &x.cachingInodeOps) + +func (x *inodeOperations) StateLoad(m state.Source) { + m.LoadWait(0, &x.fileState) + m.Load(1, &x.cachingInodeOps) +} + +func (x *inodeFileState) StateTypeName() string { + return "pkg/sentry/fs/gofer.inodeFileState" } -func (x *inodeFileState) save(m state.Map) { +func (x *inodeFileState) StateFields() []string { + return []string{ + "s", + "sattr", + "loading", + "savedUAttr", + "hostMappable", + } +} + +func (x *inodeFileState) StateSave(m state.Sink) { x.beforeSave() var loading struct{} = x.saveLoading() - m.SaveValue("loading", loading) - m.Save("s", &x.s) - m.Save("sattr", &x.sattr) - m.Save("savedUAttr", &x.savedUAttr) - m.Save("hostMappable", &x.hostMappable) -} - -func (x *inodeFileState) load(m state.Map) { - m.LoadWait("s", &x.s) - m.LoadWait("sattr", &x.sattr) - m.Load("savedUAttr", &x.savedUAttr) - m.Load("hostMappable", &x.hostMappable) - m.LoadValue("loading", new(struct{}), func(y interface{}) { x.loadLoading(y.(struct{})) }) + m.SaveValue(2, loading) + m.Save(0, &x.s) + m.Save(1, &x.sattr) + m.Save(3, &x.savedUAttr) + m.Save(4, &x.hostMappable) +} + +func (x *inodeFileState) StateLoad(m state.Source) { + m.LoadWait(0, &x.s) + m.LoadWait(1, &x.sattr) + m.Load(3, &x.savedUAttr) + m.Load(4, &x.hostMappable) + m.LoadValue(2, new(struct{}), func(y interface{}) { x.loadLoading(y.(struct{})) }) m.AfterLoad(x.afterLoad) } +func (x *overrideInfo) StateTypeName() string { + return "pkg/sentry/fs/gofer.overrideInfo" +} + +func (x *overrideInfo) StateFields() []string { + return []string{ + "dirent", + "endpoint", + "inode", + } +} + func (x *overrideInfo) beforeSave() {} -func (x *overrideInfo) save(m state.Map) { + +func (x *overrideInfo) StateSave(m state.Sink) { x.beforeSave() - m.Save("dirent", &x.dirent) - m.Save("endpoint", &x.endpoint) - m.Save("inode", &x.inode) + m.Save(0, &x.dirent) + m.Save(1, &x.endpoint) + m.Save(2, &x.inode) } func (x *overrideInfo) afterLoad() {} -func (x *overrideInfo) load(m state.Map) { - m.Load("dirent", &x.dirent) - m.Load("endpoint", &x.endpoint) - m.Load("inode", &x.inode) + +func (x *overrideInfo) StateLoad(m state.Source) { + m.Load(0, &x.dirent) + m.Load(1, &x.endpoint) + m.Load(2, &x.inode) +} + +func (x *overrideMaps) StateTypeName() string { + return "pkg/sentry/fs/gofer.overrideMaps" +} + +func (x *overrideMaps) StateFields() []string { + return []string{ + "pathMap", + } } func (x *overrideMaps) beforeSave() {} -func (x *overrideMaps) save(m state.Map) { + +func (x *overrideMaps) StateSave(m state.Sink) { x.beforeSave() - m.Save("pathMap", &x.pathMap) + m.Save(0, &x.pathMap) } func (x *overrideMaps) afterLoad() {} -func (x *overrideMaps) load(m state.Map) { - m.Load("pathMap", &x.pathMap) + +func (x *overrideMaps) StateLoad(m state.Source) { + m.Load(0, &x.pathMap) +} + +func (x *session) StateTypeName() string { + return "pkg/sentry/fs/gofer.session" +} + +func (x *session) StateFields() []string { + return []string{ + "AtomicRefCount", + "msize", + "version", + "cachePolicy", + "aname", + "superBlockFlags", + "limitHostFDTranslation", + "overlayfsStaleRead", + "connID", + "inodeMappings", + "mounter", + "overrides", + } } -func (x *session) save(m state.Map) { +func (x *session) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("msize", &x.msize) - m.Save("version", &x.version) - m.Save("cachePolicy", &x.cachePolicy) - m.Save("aname", &x.aname) - m.Save("superBlockFlags", &x.superBlockFlags) - m.Save("limitHostFDTranslation", &x.limitHostFDTranslation) - m.Save("overlayfsStaleRead", &x.overlayfsStaleRead) - m.Save("connID", &x.connID) - m.Save("inodeMappings", &x.inodeMappings) - m.Save("mounter", &x.mounter) - m.Save("overrides", &x.overrides) -} - -func (x *session) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.LoadWait("msize", &x.msize) - m.LoadWait("version", &x.version) - m.LoadWait("cachePolicy", &x.cachePolicy) - m.LoadWait("aname", &x.aname) - m.LoadWait("superBlockFlags", &x.superBlockFlags) - m.Load("limitHostFDTranslation", &x.limitHostFDTranslation) - m.Load("overlayfsStaleRead", &x.overlayfsStaleRead) - m.LoadWait("connID", &x.connID) - m.LoadWait("inodeMappings", &x.inodeMappings) - m.LoadWait("mounter", &x.mounter) - m.LoadWait("overrides", &x.overrides) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.msize) + m.Save(2, &x.version) + m.Save(3, &x.cachePolicy) + m.Save(4, &x.aname) + m.Save(5, &x.superBlockFlags) + m.Save(6, &x.limitHostFDTranslation) + m.Save(7, &x.overlayfsStaleRead) + m.Save(8, &x.connID) + m.Save(9, &x.inodeMappings) + m.Save(10, &x.mounter) + m.Save(11, &x.overrides) +} + +func (x *session) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.LoadWait(1, &x.msize) + m.LoadWait(2, &x.version) + m.LoadWait(3, &x.cachePolicy) + m.LoadWait(4, &x.aname) + m.LoadWait(5, &x.superBlockFlags) + m.Load(6, &x.limitHostFDTranslation) + m.Load(7, &x.overlayfsStaleRead) + m.LoadWait(8, &x.connID) + m.LoadWait(9, &x.inodeMappings) + m.LoadWait(10, &x.mounter) + m.LoadWait(11, &x.overrides) m.AfterLoad(x.afterLoad) } func init() { - state.Register("pkg/sentry/fs/gofer.fifo", (*fifo)(nil), state.Fns{Save: (*fifo).save, Load: (*fifo).load}) - state.Register("pkg/sentry/fs/gofer.fileOperations", (*fileOperations)(nil), state.Fns{Save: (*fileOperations).save, Load: (*fileOperations).load}) - state.Register("pkg/sentry/fs/gofer.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/gofer.inodeOperations", (*inodeOperations)(nil), state.Fns{Save: (*inodeOperations).save, Load: (*inodeOperations).load}) - state.Register("pkg/sentry/fs/gofer.inodeFileState", (*inodeFileState)(nil), state.Fns{Save: (*inodeFileState).save, Load: (*inodeFileState).load}) - state.Register("pkg/sentry/fs/gofer.overrideInfo", (*overrideInfo)(nil), state.Fns{Save: (*overrideInfo).save, Load: (*overrideInfo).load}) - state.Register("pkg/sentry/fs/gofer.overrideMaps", (*overrideMaps)(nil), state.Fns{Save: (*overrideMaps).save, Load: (*overrideMaps).load}) - state.Register("pkg/sentry/fs/gofer.session", (*session)(nil), state.Fns{Save: (*session).save, Load: (*session).load}) + state.Register((*fifo)(nil)) + state.Register((*fileOperations)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*inodeOperations)(nil)) + state.Register((*inodeFileState)(nil)) + state.Register((*overrideInfo)(nil)) + state.Register((*overrideMaps)(nil)) + state.Register((*session)(nil)) } diff --git a/pkg/sentry/fs/host/host_state_autogen.go b/pkg/sentry/fs/host/host_state_autogen.go index a6b97a154..6a1a75ca4 100644 --- a/pkg/sentry/fs/host/host_state_autogen.go +++ b/pkg/sentry/fs/host/host_state_autogen.go @@ -6,112 +6,201 @@ import ( "gvisor.dev/gvisor/pkg/state" ) -func (x *descriptor) save(m state.Map) { +func (x *descriptor) StateTypeName() string { + return "pkg/sentry/fs/host.descriptor" +} + +func (x *descriptor) StateFields() []string { + return []string{ + "origFD", + "wouldBlock", + } +} + +func (x *descriptor) StateSave(m state.Sink) { x.beforeSave() - m.Save("origFD", &x.origFD) - m.Save("wouldBlock", &x.wouldBlock) + m.Save(0, &x.origFD) + m.Save(1, &x.wouldBlock) } -func (x *descriptor) load(m state.Map) { - m.Load("origFD", &x.origFD) - m.Load("wouldBlock", &x.wouldBlock) +func (x *descriptor) StateLoad(m state.Source) { + m.Load(0, &x.origFD) + m.Load(1, &x.wouldBlock) m.AfterLoad(x.afterLoad) } +func (x *fileOperations) StateTypeName() string { + return "pkg/sentry/fs/host.fileOperations" +} + +func (x *fileOperations) StateFields() []string { + return []string{ + "iops", + "dirCursor", + } +} + func (x *fileOperations) beforeSave() {} -func (x *fileOperations) save(m state.Map) { + +func (x *fileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("iops", &x.iops) - m.Save("dirCursor", &x.dirCursor) + m.Save(0, &x.iops) + m.Save(1, &x.dirCursor) } func (x *fileOperations) afterLoad() {} -func (x *fileOperations) load(m state.Map) { - m.LoadWait("iops", &x.iops) - m.Load("dirCursor", &x.dirCursor) + +func (x *fileOperations) StateLoad(m state.Source) { + m.LoadWait(0, &x.iops) + m.Load(1, &x.dirCursor) +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/host.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} } func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *inodeOperations) StateTypeName() string { + return "pkg/sentry/fs/host.inodeOperations" +} + +func (x *inodeOperations) StateFields() []string { + return []string{ + "fileState", + "cachingInodeOps", + } } func (x *inodeOperations) beforeSave() {} -func (x *inodeOperations) save(m state.Map) { + +func (x *inodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("fileState", &x.fileState) - m.Save("cachingInodeOps", &x.cachingInodeOps) + m.Save(0, &x.fileState) + m.Save(1, &x.cachingInodeOps) } func (x *inodeOperations) afterLoad() {} -func (x *inodeOperations) load(m state.Map) { - m.LoadWait("fileState", &x.fileState) - m.Load("cachingInodeOps", &x.cachingInodeOps) + +func (x *inodeOperations) StateLoad(m state.Source) { + m.LoadWait(0, &x.fileState) + m.Load(1, &x.cachingInodeOps) +} + +func (x *inodeFileState) StateTypeName() string { + return "pkg/sentry/fs/host.inodeFileState" +} + +func (x *inodeFileState) StateFields() []string { + return []string{ + "descriptor", + "sattr", + "savedUAttr", + } } func (x *inodeFileState) beforeSave() {} -func (x *inodeFileState) save(m state.Map) { + +func (x *inodeFileState) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.queue) { - m.Failf("queue is %#v, expected zero", &x.queue) + state.Failf("queue is %#v, expected zero", &x.queue) } - m.Save("descriptor", &x.descriptor) - m.Save("sattr", &x.sattr) - m.Save("savedUAttr", &x.savedUAttr) + m.Save(0, &x.descriptor) + m.Save(1, &x.sattr) + m.Save(2, &x.savedUAttr) } -func (x *inodeFileState) load(m state.Map) { - m.LoadWait("descriptor", &x.descriptor) - m.LoadWait("sattr", &x.sattr) - m.Load("savedUAttr", &x.savedUAttr) +func (x *inodeFileState) StateLoad(m state.Source) { + m.LoadWait(0, &x.descriptor) + m.LoadWait(1, &x.sattr) + m.Load(2, &x.savedUAttr) m.AfterLoad(x.afterLoad) } -func (x *ConnectedEndpoint) save(m state.Map) { +func (x *ConnectedEndpoint) StateTypeName() string { + return "pkg/sentry/fs/host.ConnectedEndpoint" +} + +func (x *ConnectedEndpoint) StateFields() []string { + return []string{ + "ref", + "queue", + "path", + "srfd", + "stype", + } +} + +func (x *ConnectedEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("ref", &x.ref) - m.Save("queue", &x.queue) - m.Save("path", &x.path) - m.Save("srfd", &x.srfd) - m.Save("stype", &x.stype) -} - -func (x *ConnectedEndpoint) load(m state.Map) { - m.Load("ref", &x.ref) - m.Load("queue", &x.queue) - m.Load("path", &x.path) - m.LoadWait("srfd", &x.srfd) - m.Load("stype", &x.stype) + m.Save(0, &x.ref) + m.Save(1, &x.queue) + m.Save(2, &x.path) + m.Save(3, &x.srfd) + m.Save(4, &x.stype) +} + +func (x *ConnectedEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.ref) + m.Load(1, &x.queue) + m.Load(2, &x.path) + m.LoadWait(3, &x.srfd) + m.Load(4, &x.stype) m.AfterLoad(x.afterLoad) } +func (x *TTYFileOperations) StateTypeName() string { + return "pkg/sentry/fs/host.TTYFileOperations" +} + +func (x *TTYFileOperations) StateFields() []string { + return []string{ + "fileOperations", + "session", + "fgProcessGroup", + "termios", + } +} + func (x *TTYFileOperations) beforeSave() {} -func (x *TTYFileOperations) save(m state.Map) { + +func (x *TTYFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("fileOperations", &x.fileOperations) - m.Save("session", &x.session) - m.Save("fgProcessGroup", &x.fgProcessGroup) - m.Save("termios", &x.termios) + m.Save(0, &x.fileOperations) + m.Save(1, &x.session) + m.Save(2, &x.fgProcessGroup) + m.Save(3, &x.termios) } func (x *TTYFileOperations) afterLoad() {} -func (x *TTYFileOperations) load(m state.Map) { - m.Load("fileOperations", &x.fileOperations) - m.Load("session", &x.session) - m.Load("fgProcessGroup", &x.fgProcessGroup) - m.Load("termios", &x.termios) + +func (x *TTYFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.fileOperations) + m.Load(1, &x.session) + m.Load(2, &x.fgProcessGroup) + m.Load(3, &x.termios) } func init() { - state.Register("pkg/sentry/fs/host.descriptor", (*descriptor)(nil), state.Fns{Save: (*descriptor).save, Load: (*descriptor).load}) - state.Register("pkg/sentry/fs/host.fileOperations", (*fileOperations)(nil), state.Fns{Save: (*fileOperations).save, Load: (*fileOperations).load}) - state.Register("pkg/sentry/fs/host.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/host.inodeOperations", (*inodeOperations)(nil), state.Fns{Save: (*inodeOperations).save, Load: (*inodeOperations).load}) - state.Register("pkg/sentry/fs/host.inodeFileState", (*inodeFileState)(nil), state.Fns{Save: (*inodeFileState).save, Load: (*inodeFileState).load}) - state.Register("pkg/sentry/fs/host.ConnectedEndpoint", (*ConnectedEndpoint)(nil), state.Fns{Save: (*ConnectedEndpoint).save, Load: (*ConnectedEndpoint).load}) - state.Register("pkg/sentry/fs/host.TTYFileOperations", (*TTYFileOperations)(nil), state.Fns{Save: (*TTYFileOperations).save, Load: (*TTYFileOperations).load}) + state.Register((*descriptor)(nil)) + state.Register((*fileOperations)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*inodeOperations)(nil)) + state.Register((*inodeFileState)(nil)) + state.Register((*ConnectedEndpoint)(nil)) + state.Register((*TTYFileOperations)(nil)) } diff --git a/pkg/sentry/fs/lock/lock_state_autogen.go b/pkg/sentry/fs/lock/lock_state_autogen.go index 59c493fcb..8e2768c73 100644 --- a/pkg/sentry/fs/lock/lock_state_autogen.go +++ b/pkg/sentry/fs/lock/lock_state_autogen.go @@ -6,103 +6,186 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Lock) StateTypeName() string { + return "pkg/sentry/fs/lock.Lock" +} + +func (x *Lock) StateFields() []string { + return []string{ + "Readers", + "Writer", + } +} + func (x *Lock) beforeSave() {} -func (x *Lock) save(m state.Map) { + +func (x *Lock) StateSave(m state.Sink) { x.beforeSave() - m.Save("Readers", &x.Readers) - m.Save("Writer", &x.Writer) + m.Save(0, &x.Readers) + m.Save(1, &x.Writer) } func (x *Lock) afterLoad() {} -func (x *Lock) load(m state.Map) { - m.Load("Readers", &x.Readers) - m.Load("Writer", &x.Writer) + +func (x *Lock) StateLoad(m state.Source) { + m.Load(0, &x.Readers) + m.Load(1, &x.Writer) +} + +func (x *Locks) StateTypeName() string { + return "pkg/sentry/fs/lock.Locks" +} + +func (x *Locks) StateFields() []string { + return []string{ + "locks", + } } func (x *Locks) beforeSave() {} -func (x *Locks) save(m state.Map) { + +func (x *Locks) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.blockedQueue) { - m.Failf("blockedQueue is %#v, expected zero", &x.blockedQueue) + state.Failf("blockedQueue is %#v, expected zero", &x.blockedQueue) } - m.Save("locks", &x.locks) + m.Save(0, &x.locks) } func (x *Locks) afterLoad() {} -func (x *Locks) load(m state.Map) { - m.Load("locks", &x.locks) + +func (x *Locks) StateLoad(m state.Source) { + m.Load(0, &x.locks) +} + +func (x *LockRange) StateTypeName() string { + return "pkg/sentry/fs/lock.LockRange" +} + +func (x *LockRange) StateFields() []string { + return []string{ + "Start", + "End", + } } func (x *LockRange) beforeSave() {} -func (x *LockRange) save(m state.Map) { + +func (x *LockRange) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) + m.Save(0, &x.Start) + m.Save(1, &x.End) } func (x *LockRange) afterLoad() {} -func (x *LockRange) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) + +func (x *LockRange) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) +} + +func (x *LockSet) StateTypeName() string { + return "pkg/sentry/fs/lock.LockSet" +} + +func (x *LockSet) StateFields() []string { + return []string{ + "root", + } } func (x *LockSet) beforeSave() {} -func (x *LockSet) save(m state.Map) { + +func (x *LockSet) StateSave(m state.Sink) { x.beforeSave() var root *LockSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *LockSet) afterLoad() {} -func (x *LockSet) load(m state.Map) { - m.LoadValue("root", new(*LockSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*LockSegmentDataSlices)) }) + +func (x *LockSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*LockSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*LockSegmentDataSlices)) }) +} + +func (x *Locknode) StateTypeName() string { + return "pkg/sentry/fs/lock.Locknode" +} + +func (x *Locknode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *Locknode) beforeSave() {} -func (x *Locknode) save(m state.Map) { + +func (x *Locknode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &x.children) } func (x *Locknode) afterLoad() {} -func (x *Locknode) 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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *Locknode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *LockSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/fs/lock.LockSegmentDataSlices" +} + +func (x *LockSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *LockSegmentDataSlices) beforeSave() {} -func (x *LockSegmentDataSlices) save(m state.Map) { + +func (x *LockSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *LockSegmentDataSlices) afterLoad() {} -func (x *LockSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *LockSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) } func init() { - state.Register("pkg/sentry/fs/lock.Lock", (*Lock)(nil), state.Fns{Save: (*Lock).save, Load: (*Lock).load}) - state.Register("pkg/sentry/fs/lock.Locks", (*Locks)(nil), state.Fns{Save: (*Locks).save, Load: (*Locks).load}) - state.Register("pkg/sentry/fs/lock.LockRange", (*LockRange)(nil), state.Fns{Save: (*LockRange).save, Load: (*LockRange).load}) - state.Register("pkg/sentry/fs/lock.LockSet", (*LockSet)(nil), state.Fns{Save: (*LockSet).save, Load: (*LockSet).load}) - state.Register("pkg/sentry/fs/lock.Locknode", (*Locknode)(nil), state.Fns{Save: (*Locknode).save, Load: (*Locknode).load}) - state.Register("pkg/sentry/fs/lock.LockSegmentDataSlices", (*LockSegmentDataSlices)(nil), state.Fns{Save: (*LockSegmentDataSlices).save, Load: (*LockSegmentDataSlices).load}) + state.Register((*Lock)(nil)) + state.Register((*Locks)(nil)) + state.Register((*LockRange)(nil)) + state.Register((*LockSet)(nil)) + state.Register((*Locknode)(nil)) + state.Register((*LockSegmentDataSlices)(nil)) } diff --git a/pkg/sentry/fs/proc/proc_state_autogen.go b/pkg/sentry/fs/proc/proc_state_autogen.go index baf7cd42b..87c979909 100644 --- a/pkg/sentry/fs/proc/proc_state_autogen.go +++ b/pkg/sentry/fs/proc/proc_state_autogen.go @@ -6,736 +6,1430 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *execArgInode) StateTypeName() string { + return "pkg/sentry/fs/proc.execArgInode" +} + +func (x *execArgInode) StateFields() []string { + return []string{ + "SimpleFileInode", + "arg", + "t", + } +} + func (x *execArgInode) beforeSave() {} -func (x *execArgInode) save(m state.Map) { + +func (x *execArgInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("arg", &x.arg) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.arg) + m.Save(2, &x.t) } func (x *execArgInode) afterLoad() {} -func (x *execArgInode) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("arg", &x.arg) - m.Load("t", &x.t) + +func (x *execArgInode) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.arg) + m.Load(2, &x.t) +} + +func (x *execArgFile) StateTypeName() string { + return "pkg/sentry/fs/proc.execArgFile" +} + +func (x *execArgFile) StateFields() []string { + return []string{ + "arg", + "t", + } } func (x *execArgFile) beforeSave() {} -func (x *execArgFile) save(m state.Map) { + +func (x *execArgFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("arg", &x.arg) - m.Save("t", &x.t) + m.Save(0, &x.arg) + m.Save(1, &x.t) } func (x *execArgFile) afterLoad() {} -func (x *execArgFile) load(m state.Map) { - m.Load("arg", &x.arg) - m.Load("t", &x.t) + +func (x *execArgFile) StateLoad(m state.Source) { + m.Load(0, &x.arg) + m.Load(1, &x.t) +} + +func (x *fdDir) StateTypeName() string { + return "pkg/sentry/fs/proc.fdDir" +} + +func (x *fdDir) StateFields() []string { + return []string{ + "Dir", + "t", + } } func (x *fdDir) beforeSave() {} -func (x *fdDir) save(m state.Map) { + +func (x *fdDir) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("t", &x.t) + m.Save(0, &x.Dir) + m.Save(1, &x.t) } func (x *fdDir) afterLoad() {} -func (x *fdDir) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("t", &x.t) + +func (x *fdDir) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.t) +} + +func (x *fdDirFile) StateTypeName() string { + return "pkg/sentry/fs/proc.fdDirFile" +} + +func (x *fdDirFile) StateFields() []string { + return []string{ + "isInfoFile", + "t", + } } func (x *fdDirFile) beforeSave() {} -func (x *fdDirFile) save(m state.Map) { + +func (x *fdDirFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("isInfoFile", &x.isInfoFile) - m.Save("t", &x.t) + m.Save(0, &x.isInfoFile) + m.Save(1, &x.t) } func (x *fdDirFile) afterLoad() {} -func (x *fdDirFile) load(m state.Map) { - m.Load("isInfoFile", &x.isInfoFile) - m.Load("t", &x.t) + +func (x *fdDirFile) StateLoad(m state.Source) { + m.Load(0, &x.isInfoFile) + m.Load(1, &x.t) +} + +func (x *fdInfoDir) StateTypeName() string { + return "pkg/sentry/fs/proc.fdInfoDir" +} + +func (x *fdInfoDir) StateFields() []string { + return []string{ + "Dir", + "t", + } } func (x *fdInfoDir) beforeSave() {} -func (x *fdInfoDir) save(m state.Map) { + +func (x *fdInfoDir) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("t", &x.t) + m.Save(0, &x.Dir) + m.Save(1, &x.t) } func (x *fdInfoDir) afterLoad() {} -func (x *fdInfoDir) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("t", &x.t) + +func (x *fdInfoDir) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.t) +} + +func (x *filesystemsData) StateTypeName() string { + return "pkg/sentry/fs/proc.filesystemsData" +} + +func (x *filesystemsData) StateFields() []string { + return []string{} } func (x *filesystemsData) beforeSave() {} -func (x *filesystemsData) save(m state.Map) { + +func (x *filesystemsData) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystemsData) afterLoad() {} -func (x *filesystemsData) load(m state.Map) { + +func (x *filesystemsData) StateLoad(m state.Source) { +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/proc.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} } func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *taskOwnedInodeOps) StateTypeName() string { + return "pkg/sentry/fs/proc.taskOwnedInodeOps" +} + +func (x *taskOwnedInodeOps) StateFields() []string { + return []string{ + "InodeOperations", + "t", + } } func (x *taskOwnedInodeOps) beforeSave() {} -func (x *taskOwnedInodeOps) save(m state.Map) { + +func (x *taskOwnedInodeOps) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeOperations", &x.InodeOperations) - m.Save("t", &x.t) + m.Save(0, &x.InodeOperations) + m.Save(1, &x.t) } func (x *taskOwnedInodeOps) afterLoad() {} -func (x *taskOwnedInodeOps) load(m state.Map) { - m.Load("InodeOperations", &x.InodeOperations) - m.Load("t", &x.t) + +func (x *taskOwnedInodeOps) StateLoad(m state.Source) { + m.Load(0, &x.InodeOperations) + m.Load(1, &x.t) +} + +func (x *staticFileInodeOps) StateTypeName() string { + return "pkg/sentry/fs/proc.staticFileInodeOps" +} + +func (x *staticFileInodeOps) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeStaticFileGetter", + } } func (x *staticFileInodeOps) beforeSave() {} -func (x *staticFileInodeOps) save(m state.Map) { + +func (x *staticFileInodeOps) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeStaticFileGetter", &x.InodeStaticFileGetter) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeStaticFileGetter) } func (x *staticFileInodeOps) afterLoad() {} -func (x *staticFileInodeOps) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeStaticFileGetter", &x.InodeStaticFileGetter) + +func (x *staticFileInodeOps) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeStaticFileGetter) +} + +func (x *loadavgData) StateTypeName() string { + return "pkg/sentry/fs/proc.loadavgData" +} + +func (x *loadavgData) StateFields() []string { + return []string{} } func (x *loadavgData) beforeSave() {} -func (x *loadavgData) save(m state.Map) { + +func (x *loadavgData) StateSave(m state.Sink) { x.beforeSave() } func (x *loadavgData) afterLoad() {} -func (x *loadavgData) load(m state.Map) { + +func (x *loadavgData) StateLoad(m state.Source) { +} + +func (x *meminfoData) StateTypeName() string { + return "pkg/sentry/fs/proc.meminfoData" +} + +func (x *meminfoData) StateFields() []string { + return []string{ + "k", + } } func (x *meminfoData) beforeSave() {} -func (x *meminfoData) save(m state.Map) { + +func (x *meminfoData) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *meminfoData) afterLoad() {} -func (x *meminfoData) load(m state.Map) { - m.Load("k", &x.k) + +func (x *meminfoData) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *mountInfoFile) StateTypeName() string { + return "pkg/sentry/fs/proc.mountInfoFile" +} + +func (x *mountInfoFile) StateFields() []string { + return []string{ + "t", + } } func (x *mountInfoFile) beforeSave() {} -func (x *mountInfoFile) save(m state.Map) { + +func (x *mountInfoFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *mountInfoFile) afterLoad() {} -func (x *mountInfoFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *mountInfoFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *mountsFile) StateTypeName() string { + return "pkg/sentry/fs/proc.mountsFile" +} + +func (x *mountsFile) StateFields() []string { + return []string{ + "t", + } } func (x *mountsFile) beforeSave() {} -func (x *mountsFile) save(m state.Map) { + +func (x *mountsFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *mountsFile) afterLoad() {} -func (x *mountsFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *mountsFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *ifinet6) StateTypeName() string { + return "pkg/sentry/fs/proc.ifinet6" +} + +func (x *ifinet6) StateFields() []string { + return []string{ + "s", + } } func (x *ifinet6) beforeSave() {} -func (x *ifinet6) save(m state.Map) { + +func (x *ifinet6) StateSave(m state.Sink) { x.beforeSave() - m.Save("s", &x.s) + m.Save(0, &x.s) } func (x *ifinet6) afterLoad() {} -func (x *ifinet6) load(m state.Map) { - m.Load("s", &x.s) + +func (x *ifinet6) StateLoad(m state.Source) { + m.Load(0, &x.s) +} + +func (x *netDev) StateTypeName() string { + return "pkg/sentry/fs/proc.netDev" +} + +func (x *netDev) StateFields() []string { + return []string{ + "s", + } } func (x *netDev) beforeSave() {} -func (x *netDev) save(m state.Map) { + +func (x *netDev) StateSave(m state.Sink) { x.beforeSave() - m.Save("s", &x.s) + m.Save(0, &x.s) } func (x *netDev) afterLoad() {} -func (x *netDev) load(m state.Map) { - m.Load("s", &x.s) + +func (x *netDev) StateLoad(m state.Source) { + m.Load(0, &x.s) +} + +func (x *netSnmp) StateTypeName() string { + return "pkg/sentry/fs/proc.netSnmp" +} + +func (x *netSnmp) StateFields() []string { + return []string{ + "s", + } } func (x *netSnmp) beforeSave() {} -func (x *netSnmp) save(m state.Map) { + +func (x *netSnmp) StateSave(m state.Sink) { x.beforeSave() - m.Save("s", &x.s) + m.Save(0, &x.s) } func (x *netSnmp) afterLoad() {} -func (x *netSnmp) load(m state.Map) { - m.Load("s", &x.s) + +func (x *netSnmp) StateLoad(m state.Source) { + m.Load(0, &x.s) +} + +func (x *netRoute) StateTypeName() string { + return "pkg/sentry/fs/proc.netRoute" +} + +func (x *netRoute) StateFields() []string { + return []string{ + "s", + } } func (x *netRoute) beforeSave() {} -func (x *netRoute) save(m state.Map) { + +func (x *netRoute) StateSave(m state.Sink) { x.beforeSave() - m.Save("s", &x.s) + m.Save(0, &x.s) } func (x *netRoute) afterLoad() {} -func (x *netRoute) load(m state.Map) { - m.Load("s", &x.s) + +func (x *netRoute) StateLoad(m state.Source) { + m.Load(0, &x.s) +} + +func (x *netUnix) StateTypeName() string { + return "pkg/sentry/fs/proc.netUnix" +} + +func (x *netUnix) StateFields() []string { + return []string{ + "k", + } } func (x *netUnix) beforeSave() {} -func (x *netUnix) save(m state.Map) { + +func (x *netUnix) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *netUnix) afterLoad() {} -func (x *netUnix) load(m state.Map) { - m.Load("k", &x.k) + +func (x *netUnix) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *netTCP) StateTypeName() string { + return "pkg/sentry/fs/proc.netTCP" +} + +func (x *netTCP) StateFields() []string { + return []string{ + "k", + } } func (x *netTCP) beforeSave() {} -func (x *netTCP) save(m state.Map) { + +func (x *netTCP) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *netTCP) afterLoad() {} -func (x *netTCP) load(m state.Map) { - m.Load("k", &x.k) + +func (x *netTCP) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *netTCP6) StateTypeName() string { + return "pkg/sentry/fs/proc.netTCP6" +} + +func (x *netTCP6) StateFields() []string { + return []string{ + "k", + } } func (x *netTCP6) beforeSave() {} -func (x *netTCP6) save(m state.Map) { + +func (x *netTCP6) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *netTCP6) afterLoad() {} -func (x *netTCP6) load(m state.Map) { - m.Load("k", &x.k) + +func (x *netTCP6) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *netUDP) StateTypeName() string { + return "pkg/sentry/fs/proc.netUDP" +} + +func (x *netUDP) StateFields() []string { + return []string{ + "k", + } } func (x *netUDP) beforeSave() {} -func (x *netUDP) save(m state.Map) { + +func (x *netUDP) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *netUDP) afterLoad() {} -func (x *netUDP) load(m state.Map) { - m.Load("k", &x.k) + +func (x *netUDP) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *proc) StateTypeName() string { + return "pkg/sentry/fs/proc.proc" +} + +func (x *proc) StateFields() []string { + return []string{ + "Dir", + "k", + "pidns", + "cgroupControllers", + } } func (x *proc) beforeSave() {} -func (x *proc) save(m state.Map) { + +func (x *proc) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("k", &x.k) - m.Save("pidns", &x.pidns) - m.Save("cgroupControllers", &x.cgroupControllers) + m.Save(0, &x.Dir) + m.Save(1, &x.k) + m.Save(2, &x.pidns) + m.Save(3, &x.cgroupControllers) } func (x *proc) afterLoad() {} -func (x *proc) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("k", &x.k) - m.Load("pidns", &x.pidns) - m.Load("cgroupControllers", &x.cgroupControllers) + +func (x *proc) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.k) + m.Load(2, &x.pidns) + m.Load(3, &x.cgroupControllers) +} + +func (x *self) StateTypeName() string { + return "pkg/sentry/fs/proc.self" +} + +func (x *self) StateFields() []string { + return []string{ + "Symlink", + "pidns", + } } func (x *self) beforeSave() {} -func (x *self) save(m state.Map) { + +func (x *self) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) - m.Save("pidns", &x.pidns) + m.Save(0, &x.Symlink) + m.Save(1, &x.pidns) } func (x *self) afterLoad() {} -func (x *self) load(m state.Map) { - m.Load("Symlink", &x.Symlink) - m.Load("pidns", &x.pidns) + +func (x *self) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) + m.Load(1, &x.pidns) +} + +func (x *threadSelf) StateTypeName() string { + return "pkg/sentry/fs/proc.threadSelf" +} + +func (x *threadSelf) StateFields() []string { + return []string{ + "Symlink", + "pidns", + } } func (x *threadSelf) beforeSave() {} -func (x *threadSelf) save(m state.Map) { + +func (x *threadSelf) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) - m.Save("pidns", &x.pidns) + m.Save(0, &x.Symlink) + m.Save(1, &x.pidns) } func (x *threadSelf) afterLoad() {} -func (x *threadSelf) load(m state.Map) { - m.Load("Symlink", &x.Symlink) - m.Load("pidns", &x.pidns) + +func (x *threadSelf) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) + m.Load(1, &x.pidns) +} + +func (x *rootProcFile) StateTypeName() string { + return "pkg/sentry/fs/proc.rootProcFile" +} + +func (x *rootProcFile) StateFields() []string { + return []string{ + "iops", + } } func (x *rootProcFile) beforeSave() {} -func (x *rootProcFile) save(m state.Map) { + +func (x *rootProcFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("iops", &x.iops) + m.Save(0, &x.iops) } func (x *rootProcFile) afterLoad() {} -func (x *rootProcFile) load(m state.Map) { - m.Load("iops", &x.iops) + +func (x *rootProcFile) StateLoad(m state.Source) { + m.Load(0, &x.iops) +} + +func (x *statData) StateTypeName() string { + return "pkg/sentry/fs/proc.statData" +} + +func (x *statData) StateFields() []string { + return []string{ + "k", + } } func (x *statData) beforeSave() {} -func (x *statData) save(m state.Map) { + +func (x *statData) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *statData) afterLoad() {} -func (x *statData) load(m state.Map) { - m.Load("k", &x.k) + +func (x *statData) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *mmapMinAddrData) StateTypeName() string { + return "pkg/sentry/fs/proc.mmapMinAddrData" +} + +func (x *mmapMinAddrData) StateFields() []string { + return []string{ + "k", + } } func (x *mmapMinAddrData) beforeSave() {} -func (x *mmapMinAddrData) save(m state.Map) { + +func (x *mmapMinAddrData) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *mmapMinAddrData) afterLoad() {} -func (x *mmapMinAddrData) load(m state.Map) { - m.Load("k", &x.k) + +func (x *mmapMinAddrData) StateLoad(m state.Source) { + m.Load(0, &x.k) +} + +func (x *overcommitMemory) StateTypeName() string { + return "pkg/sentry/fs/proc.overcommitMemory" +} + +func (x *overcommitMemory) StateFields() []string { + return []string{} } func (x *overcommitMemory) beforeSave() {} -func (x *overcommitMemory) save(m state.Map) { + +func (x *overcommitMemory) StateSave(m state.Sink) { x.beforeSave() } func (x *overcommitMemory) afterLoad() {} -func (x *overcommitMemory) load(m state.Map) { + +func (x *overcommitMemory) StateLoad(m state.Source) { +} + +func (x *hostname) StateTypeName() string { + return "pkg/sentry/fs/proc.hostname" +} + +func (x *hostname) StateFields() []string { + return []string{ + "SimpleFileInode", + } } func (x *hostname) beforeSave() {} -func (x *hostname) save(m state.Map) { + +func (x *hostname) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) + m.Save(0, &x.SimpleFileInode) } func (x *hostname) afterLoad() {} -func (x *hostname) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) + +func (x *hostname) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) +} + +func (x *hostnameFile) StateTypeName() string { + return "pkg/sentry/fs/proc.hostnameFile" +} + +func (x *hostnameFile) StateFields() []string { + return []string{} } func (x *hostnameFile) beforeSave() {} -func (x *hostnameFile) save(m state.Map) { + +func (x *hostnameFile) StateSave(m state.Sink) { x.beforeSave() } func (x *hostnameFile) afterLoad() {} -func (x *hostnameFile) load(m state.Map) { + +func (x *hostnameFile) StateLoad(m state.Source) { +} + +func (x *tcpMemInode) StateTypeName() string { + return "pkg/sentry/fs/proc.tcpMemInode" +} + +func (x *tcpMemInode) StateFields() []string { + return []string{ + "SimpleFileInode", + "dir", + "s", + "size", + } } -func (x *tcpMemInode) save(m state.Map) { +func (x *tcpMemInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("dir", &x.dir) - m.Save("s", &x.s) - m.Save("size", &x.size) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.dir) + m.Save(2, &x.s) + m.Save(3, &x.size) } -func (x *tcpMemInode) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("dir", &x.dir) - m.LoadWait("s", &x.s) - m.Load("size", &x.size) +func (x *tcpMemInode) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.dir) + m.LoadWait(2, &x.s) + m.Load(3, &x.size) m.AfterLoad(x.afterLoad) } +func (x *tcpMemFile) StateTypeName() string { + return "pkg/sentry/fs/proc.tcpMemFile" +} + +func (x *tcpMemFile) StateFields() []string { + return []string{ + "tcpMemInode", + } +} + func (x *tcpMemFile) beforeSave() {} -func (x *tcpMemFile) save(m state.Map) { + +func (x *tcpMemFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("tcpMemInode", &x.tcpMemInode) + m.Save(0, &x.tcpMemInode) } func (x *tcpMemFile) afterLoad() {} -func (x *tcpMemFile) load(m state.Map) { - m.Load("tcpMemInode", &x.tcpMemInode) + +func (x *tcpMemFile) StateLoad(m state.Source) { + m.Load(0, &x.tcpMemInode) +} + +func (x *tcpSack) StateTypeName() string { + return "pkg/sentry/fs/proc.tcpSack" +} + +func (x *tcpSack) StateFields() []string { + return []string{ + "SimpleFileInode", + "stack", + "enabled", + } } func (x *tcpSack) beforeSave() {} -func (x *tcpSack) save(m state.Map) { + +func (x *tcpSack) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("stack", &x.stack) - m.Save("enabled", &x.enabled) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.stack) + m.Save(2, &x.enabled) } -func (x *tcpSack) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.LoadWait("stack", &x.stack) - m.Load("enabled", &x.enabled) +func (x *tcpSack) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.LoadWait(1, &x.stack) + m.Load(2, &x.enabled) m.AfterLoad(x.afterLoad) } +func (x *tcpSackFile) StateTypeName() string { + return "pkg/sentry/fs/proc.tcpSackFile" +} + +func (x *tcpSackFile) StateFields() []string { + return []string{ + "tcpSack", + "stack", + } +} + func (x *tcpSackFile) beforeSave() {} -func (x *tcpSackFile) save(m state.Map) { + +func (x *tcpSackFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("tcpSack", &x.tcpSack) - m.Save("stack", &x.stack) + m.Save(0, &x.tcpSack) + m.Save(1, &x.stack) } func (x *tcpSackFile) afterLoad() {} -func (x *tcpSackFile) load(m state.Map) { - m.Load("tcpSack", &x.tcpSack) - m.LoadWait("stack", &x.stack) + +func (x *tcpSackFile) StateLoad(m state.Source) { + m.Load(0, &x.tcpSack) + m.LoadWait(1, &x.stack) +} + +func (x *taskDir) StateTypeName() string { + return "pkg/sentry/fs/proc.taskDir" +} + +func (x *taskDir) StateFields() []string { + return []string{ + "Dir", + "t", + } } func (x *taskDir) beforeSave() {} -func (x *taskDir) save(m state.Map) { + +func (x *taskDir) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("t", &x.t) + m.Save(0, &x.Dir) + m.Save(1, &x.t) } func (x *taskDir) afterLoad() {} -func (x *taskDir) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("t", &x.t) + +func (x *taskDir) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.t) +} + +func (x *subtasks) StateTypeName() string { + return "pkg/sentry/fs/proc.subtasks" +} + +func (x *subtasks) StateFields() []string { + return []string{ + "Dir", + "t", + "p", + } } func (x *subtasks) beforeSave() {} -func (x *subtasks) save(m state.Map) { + +func (x *subtasks) StateSave(m state.Sink) { x.beforeSave() - m.Save("Dir", &x.Dir) - m.Save("t", &x.t) - m.Save("p", &x.p) + m.Save(0, &x.Dir) + m.Save(1, &x.t) + m.Save(2, &x.p) } func (x *subtasks) afterLoad() {} -func (x *subtasks) load(m state.Map) { - m.Load("Dir", &x.Dir) - m.Load("t", &x.t) - m.Load("p", &x.p) + +func (x *subtasks) StateLoad(m state.Source) { + m.Load(0, &x.Dir) + m.Load(1, &x.t) + m.Load(2, &x.p) +} + +func (x *subtasksFile) StateTypeName() string { + return "pkg/sentry/fs/proc.subtasksFile" +} + +func (x *subtasksFile) StateFields() []string { + return []string{ + "t", + "pidns", + } } func (x *subtasksFile) beforeSave() {} -func (x *subtasksFile) save(m state.Map) { + +func (x *subtasksFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("pidns", &x.pidns) + m.Save(0, &x.t) + m.Save(1, &x.pidns) } func (x *subtasksFile) afterLoad() {} -func (x *subtasksFile) load(m state.Map) { - m.Load("t", &x.t) - m.Load("pidns", &x.pidns) + +func (x *subtasksFile) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.pidns) +} + +func (x *exe) StateTypeName() string { + return "pkg/sentry/fs/proc.exe" +} + +func (x *exe) StateFields() []string { + return []string{ + "Symlink", + "t", + } } func (x *exe) beforeSave() {} -func (x *exe) save(m state.Map) { + +func (x *exe) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) - m.Save("t", &x.t) + m.Save(0, &x.Symlink) + m.Save(1, &x.t) } func (x *exe) afterLoad() {} -func (x *exe) load(m state.Map) { - m.Load("Symlink", &x.Symlink) - m.Load("t", &x.t) + +func (x *exe) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) + m.Load(1, &x.t) +} + +func (x *namespaceSymlink) StateTypeName() string { + return "pkg/sentry/fs/proc.namespaceSymlink" +} + +func (x *namespaceSymlink) StateFields() []string { + return []string{ + "Symlink", + "t", + } } func (x *namespaceSymlink) beforeSave() {} -func (x *namespaceSymlink) save(m state.Map) { + +func (x *namespaceSymlink) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) - m.Save("t", &x.t) + m.Save(0, &x.Symlink) + m.Save(1, &x.t) } func (x *namespaceSymlink) afterLoad() {} -func (x *namespaceSymlink) load(m state.Map) { - m.Load("Symlink", &x.Symlink) - m.Load("t", &x.t) + +func (x *namespaceSymlink) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) + m.Load(1, &x.t) +} + +func (x *mapsData) StateTypeName() string { + return "pkg/sentry/fs/proc.mapsData" +} + +func (x *mapsData) StateFields() []string { + return []string{ + "t", + } } func (x *mapsData) beforeSave() {} -func (x *mapsData) save(m state.Map) { + +func (x *mapsData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *mapsData) afterLoad() {} -func (x *mapsData) load(m state.Map) { - m.Load("t", &x.t) + +func (x *mapsData) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *smapsData) StateTypeName() string { + return "pkg/sentry/fs/proc.smapsData" +} + +func (x *smapsData) StateFields() []string { + return []string{ + "t", + } } func (x *smapsData) beforeSave() {} -func (x *smapsData) save(m state.Map) { + +func (x *smapsData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *smapsData) afterLoad() {} -func (x *smapsData) load(m state.Map) { - m.Load("t", &x.t) + +func (x *smapsData) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *taskStatData) StateTypeName() string { + return "pkg/sentry/fs/proc.taskStatData" +} + +func (x *taskStatData) StateFields() []string { + return []string{ + "t", + "tgstats", + "pidns", + } } func (x *taskStatData) beforeSave() {} -func (x *taskStatData) save(m state.Map) { + +func (x *taskStatData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("tgstats", &x.tgstats) - m.Save("pidns", &x.pidns) + m.Save(0, &x.t) + m.Save(1, &x.tgstats) + m.Save(2, &x.pidns) } func (x *taskStatData) afterLoad() {} -func (x *taskStatData) load(m state.Map) { - m.Load("t", &x.t) - m.Load("tgstats", &x.tgstats) - m.Load("pidns", &x.pidns) + +func (x *taskStatData) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.tgstats) + m.Load(2, &x.pidns) +} + +func (x *statmData) StateTypeName() string { + return "pkg/sentry/fs/proc.statmData" +} + +func (x *statmData) StateFields() []string { + return []string{ + "t", + } } func (x *statmData) beforeSave() {} -func (x *statmData) save(m state.Map) { + +func (x *statmData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *statmData) afterLoad() {} -func (x *statmData) load(m state.Map) { - m.Load("t", &x.t) + +func (x *statmData) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *statusData) StateTypeName() string { + return "pkg/sentry/fs/proc.statusData" +} + +func (x *statusData) StateFields() []string { + return []string{ + "t", + "pidns", + } } func (x *statusData) beforeSave() {} -func (x *statusData) save(m state.Map) { + +func (x *statusData) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("pidns", &x.pidns) + m.Save(0, &x.t) + m.Save(1, &x.pidns) } func (x *statusData) afterLoad() {} -func (x *statusData) load(m state.Map) { - m.Load("t", &x.t) - m.Load("pidns", &x.pidns) + +func (x *statusData) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.pidns) +} + +func (x *ioData) StateTypeName() string { + return "pkg/sentry/fs/proc.ioData" +} + +func (x *ioData) StateFields() []string { + return []string{ + "ioUsage", + } } func (x *ioData) beforeSave() {} -func (x *ioData) save(m state.Map) { + +func (x *ioData) StateSave(m state.Sink) { x.beforeSave() - m.Save("ioUsage", &x.ioUsage) + m.Save(0, &x.ioUsage) } func (x *ioData) afterLoad() {} -func (x *ioData) load(m state.Map) { - m.Load("ioUsage", &x.ioUsage) + +func (x *ioData) StateLoad(m state.Source) { + m.Load(0, &x.ioUsage) +} + +func (x *comm) StateTypeName() string { + return "pkg/sentry/fs/proc.comm" +} + +func (x *comm) StateFields() []string { + return []string{ + "SimpleFileInode", + "t", + } } func (x *comm) beforeSave() {} -func (x *comm) save(m state.Map) { + +func (x *comm) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.t) } func (x *comm) afterLoad() {} -func (x *comm) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("t", &x.t) + +func (x *comm) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.t) +} + +func (x *commFile) StateTypeName() string { + return "pkg/sentry/fs/proc.commFile" +} + +func (x *commFile) StateFields() []string { + return []string{ + "t", + } } func (x *commFile) beforeSave() {} -func (x *commFile) save(m state.Map) { + +func (x *commFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *commFile) afterLoad() {} -func (x *commFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *commFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *auxvec) StateTypeName() string { + return "pkg/sentry/fs/proc.auxvec" +} + +func (x *auxvec) StateFields() []string { + return []string{ + "SimpleFileInode", + "t", + } } func (x *auxvec) beforeSave() {} -func (x *auxvec) save(m state.Map) { + +func (x *auxvec) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.t) } func (x *auxvec) afterLoad() {} -func (x *auxvec) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("t", &x.t) + +func (x *auxvec) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.t) +} + +func (x *auxvecFile) StateTypeName() string { + return "pkg/sentry/fs/proc.auxvecFile" +} + +func (x *auxvecFile) StateFields() []string { + return []string{ + "t", + } } func (x *auxvecFile) beforeSave() {} -func (x *auxvecFile) save(m state.Map) { + +func (x *auxvecFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *auxvecFile) afterLoad() {} -func (x *auxvecFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *auxvecFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *oomScoreAdj) StateTypeName() string { + return "pkg/sentry/fs/proc.oomScoreAdj" +} + +func (x *oomScoreAdj) StateFields() []string { + return []string{ + "SimpleFileInode", + "t", + } } func (x *oomScoreAdj) beforeSave() {} -func (x *oomScoreAdj) save(m state.Map) { + +func (x *oomScoreAdj) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.t) } func (x *oomScoreAdj) afterLoad() {} -func (x *oomScoreAdj) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("t", &x.t) + +func (x *oomScoreAdj) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.t) +} + +func (x *oomScoreAdjFile) StateTypeName() string { + return "pkg/sentry/fs/proc.oomScoreAdjFile" +} + +func (x *oomScoreAdjFile) StateFields() []string { + return []string{ + "t", + } } func (x *oomScoreAdjFile) beforeSave() {} -func (x *oomScoreAdjFile) save(m state.Map) { + +func (x *oomScoreAdjFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) + m.Save(0, &x.t) } func (x *oomScoreAdjFile) afterLoad() {} -func (x *oomScoreAdjFile) load(m state.Map) { - m.Load("t", &x.t) + +func (x *oomScoreAdjFile) StateLoad(m state.Source) { + m.Load(0, &x.t) +} + +func (x *idMapInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/proc.idMapInodeOperations" +} + +func (x *idMapInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeSimpleExtendedAttributes", + "t", + "gids", + } } func (x *idMapInodeOperations) beforeSave() {} -func (x *idMapInodeOperations) save(m state.Map) { + +func (x *idMapInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("t", &x.t) - m.Save("gids", &x.gids) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeSimpleExtendedAttributes) + m.Save(2, &x.t) + m.Save(3, &x.gids) } func (x *idMapInodeOperations) afterLoad() {} -func (x *idMapInodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("t", &x.t) - m.Load("gids", &x.gids) + +func (x *idMapInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeSimpleExtendedAttributes) + m.Load(2, &x.t) + m.Load(3, &x.gids) +} + +func (x *idMapFileOperations) StateTypeName() string { + return "pkg/sentry/fs/proc.idMapFileOperations" +} + +func (x *idMapFileOperations) StateFields() []string { + return []string{ + "iops", + } } func (x *idMapFileOperations) beforeSave() {} -func (x *idMapFileOperations) save(m state.Map) { + +func (x *idMapFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("iops", &x.iops) + m.Save(0, &x.iops) } func (x *idMapFileOperations) afterLoad() {} -func (x *idMapFileOperations) load(m state.Map) { - m.Load("iops", &x.iops) + +func (x *idMapFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.iops) +} + +func (x *uptime) StateTypeName() string { + return "pkg/sentry/fs/proc.uptime" +} + +func (x *uptime) StateFields() []string { + return []string{ + "SimpleFileInode", + "startTime", + } } func (x *uptime) beforeSave() {} -func (x *uptime) save(m state.Map) { + +func (x *uptime) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("startTime", &x.startTime) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.startTime) } func (x *uptime) afterLoad() {} -func (x *uptime) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("startTime", &x.startTime) + +func (x *uptime) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.startTime) +} + +func (x *uptimeFile) StateTypeName() string { + return "pkg/sentry/fs/proc.uptimeFile" +} + +func (x *uptimeFile) StateFields() []string { + return []string{ + "startTime", + } } func (x *uptimeFile) beforeSave() {} -func (x *uptimeFile) save(m state.Map) { + +func (x *uptimeFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("startTime", &x.startTime) + m.Save(0, &x.startTime) } func (x *uptimeFile) afterLoad() {} -func (x *uptimeFile) load(m state.Map) { - m.Load("startTime", &x.startTime) + +func (x *uptimeFile) StateLoad(m state.Source) { + m.Load(0, &x.startTime) +} + +func (x *versionData) StateTypeName() string { + return "pkg/sentry/fs/proc.versionData" +} + +func (x *versionData) StateFields() []string { + return []string{ + "k", + } } func (x *versionData) beforeSave() {} -func (x *versionData) save(m state.Map) { + +func (x *versionData) StateSave(m state.Sink) { x.beforeSave() - m.Save("k", &x.k) + m.Save(0, &x.k) } func (x *versionData) afterLoad() {} -func (x *versionData) load(m state.Map) { - m.Load("k", &x.k) + +func (x *versionData) StateLoad(m state.Source) { + m.Load(0, &x.k) } func init() { - state.Register("pkg/sentry/fs/proc.execArgInode", (*execArgInode)(nil), state.Fns{Save: (*execArgInode).save, Load: (*execArgInode).load}) - state.Register("pkg/sentry/fs/proc.execArgFile", (*execArgFile)(nil), state.Fns{Save: (*execArgFile).save, Load: (*execArgFile).load}) - state.Register("pkg/sentry/fs/proc.fdDir", (*fdDir)(nil), state.Fns{Save: (*fdDir).save, Load: (*fdDir).load}) - state.Register("pkg/sentry/fs/proc.fdDirFile", (*fdDirFile)(nil), state.Fns{Save: (*fdDirFile).save, Load: (*fdDirFile).load}) - state.Register("pkg/sentry/fs/proc.fdInfoDir", (*fdInfoDir)(nil), state.Fns{Save: (*fdInfoDir).save, Load: (*fdInfoDir).load}) - state.Register("pkg/sentry/fs/proc.filesystemsData", (*filesystemsData)(nil), state.Fns{Save: (*filesystemsData).save, Load: (*filesystemsData).load}) - state.Register("pkg/sentry/fs/proc.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/proc.taskOwnedInodeOps", (*taskOwnedInodeOps)(nil), state.Fns{Save: (*taskOwnedInodeOps).save, Load: (*taskOwnedInodeOps).load}) - state.Register("pkg/sentry/fs/proc.staticFileInodeOps", (*staticFileInodeOps)(nil), state.Fns{Save: (*staticFileInodeOps).save, Load: (*staticFileInodeOps).load}) - state.Register("pkg/sentry/fs/proc.loadavgData", (*loadavgData)(nil), state.Fns{Save: (*loadavgData).save, Load: (*loadavgData).load}) - state.Register("pkg/sentry/fs/proc.meminfoData", (*meminfoData)(nil), state.Fns{Save: (*meminfoData).save, Load: (*meminfoData).load}) - state.Register("pkg/sentry/fs/proc.mountInfoFile", (*mountInfoFile)(nil), state.Fns{Save: (*mountInfoFile).save, Load: (*mountInfoFile).load}) - state.Register("pkg/sentry/fs/proc.mountsFile", (*mountsFile)(nil), state.Fns{Save: (*mountsFile).save, Load: (*mountsFile).load}) - state.Register("pkg/sentry/fs/proc.ifinet6", (*ifinet6)(nil), state.Fns{Save: (*ifinet6).save, Load: (*ifinet6).load}) - state.Register("pkg/sentry/fs/proc.netDev", (*netDev)(nil), state.Fns{Save: (*netDev).save, Load: (*netDev).load}) - state.Register("pkg/sentry/fs/proc.netSnmp", (*netSnmp)(nil), state.Fns{Save: (*netSnmp).save, Load: (*netSnmp).load}) - state.Register("pkg/sentry/fs/proc.netRoute", (*netRoute)(nil), state.Fns{Save: (*netRoute).save, Load: (*netRoute).load}) - state.Register("pkg/sentry/fs/proc.netUnix", (*netUnix)(nil), state.Fns{Save: (*netUnix).save, Load: (*netUnix).load}) - state.Register("pkg/sentry/fs/proc.netTCP", (*netTCP)(nil), state.Fns{Save: (*netTCP).save, Load: (*netTCP).load}) - state.Register("pkg/sentry/fs/proc.netTCP6", (*netTCP6)(nil), state.Fns{Save: (*netTCP6).save, Load: (*netTCP6).load}) - state.Register("pkg/sentry/fs/proc.netUDP", (*netUDP)(nil), state.Fns{Save: (*netUDP).save, Load: (*netUDP).load}) - state.Register("pkg/sentry/fs/proc.proc", (*proc)(nil), state.Fns{Save: (*proc).save, Load: (*proc).load}) - state.Register("pkg/sentry/fs/proc.self", (*self)(nil), state.Fns{Save: (*self).save, Load: (*self).load}) - state.Register("pkg/sentry/fs/proc.threadSelf", (*threadSelf)(nil), state.Fns{Save: (*threadSelf).save, Load: (*threadSelf).load}) - state.Register("pkg/sentry/fs/proc.rootProcFile", (*rootProcFile)(nil), state.Fns{Save: (*rootProcFile).save, Load: (*rootProcFile).load}) - state.Register("pkg/sentry/fs/proc.statData", (*statData)(nil), state.Fns{Save: (*statData).save, Load: (*statData).load}) - state.Register("pkg/sentry/fs/proc.mmapMinAddrData", (*mmapMinAddrData)(nil), state.Fns{Save: (*mmapMinAddrData).save, Load: (*mmapMinAddrData).load}) - state.Register("pkg/sentry/fs/proc.overcommitMemory", (*overcommitMemory)(nil), state.Fns{Save: (*overcommitMemory).save, Load: (*overcommitMemory).load}) - state.Register("pkg/sentry/fs/proc.hostname", (*hostname)(nil), state.Fns{Save: (*hostname).save, Load: (*hostname).load}) - state.Register("pkg/sentry/fs/proc.hostnameFile", (*hostnameFile)(nil), state.Fns{Save: (*hostnameFile).save, Load: (*hostnameFile).load}) - state.Register("pkg/sentry/fs/proc.tcpMemInode", (*tcpMemInode)(nil), state.Fns{Save: (*tcpMemInode).save, Load: (*tcpMemInode).load}) - state.Register("pkg/sentry/fs/proc.tcpMemFile", (*tcpMemFile)(nil), state.Fns{Save: (*tcpMemFile).save, Load: (*tcpMemFile).load}) - state.Register("pkg/sentry/fs/proc.tcpSack", (*tcpSack)(nil), state.Fns{Save: (*tcpSack).save, Load: (*tcpSack).load}) - state.Register("pkg/sentry/fs/proc.tcpSackFile", (*tcpSackFile)(nil), state.Fns{Save: (*tcpSackFile).save, Load: (*tcpSackFile).load}) - state.Register("pkg/sentry/fs/proc.taskDir", (*taskDir)(nil), state.Fns{Save: (*taskDir).save, Load: (*taskDir).load}) - state.Register("pkg/sentry/fs/proc.subtasks", (*subtasks)(nil), state.Fns{Save: (*subtasks).save, Load: (*subtasks).load}) - state.Register("pkg/sentry/fs/proc.subtasksFile", (*subtasksFile)(nil), state.Fns{Save: (*subtasksFile).save, Load: (*subtasksFile).load}) - state.Register("pkg/sentry/fs/proc.exe", (*exe)(nil), state.Fns{Save: (*exe).save, Load: (*exe).load}) - state.Register("pkg/sentry/fs/proc.namespaceSymlink", (*namespaceSymlink)(nil), state.Fns{Save: (*namespaceSymlink).save, Load: (*namespaceSymlink).load}) - state.Register("pkg/sentry/fs/proc.mapsData", (*mapsData)(nil), state.Fns{Save: (*mapsData).save, Load: (*mapsData).load}) - state.Register("pkg/sentry/fs/proc.smapsData", (*smapsData)(nil), state.Fns{Save: (*smapsData).save, Load: (*smapsData).load}) - state.Register("pkg/sentry/fs/proc.taskStatData", (*taskStatData)(nil), state.Fns{Save: (*taskStatData).save, Load: (*taskStatData).load}) - state.Register("pkg/sentry/fs/proc.statmData", (*statmData)(nil), state.Fns{Save: (*statmData).save, Load: (*statmData).load}) - state.Register("pkg/sentry/fs/proc.statusData", (*statusData)(nil), state.Fns{Save: (*statusData).save, Load: (*statusData).load}) - state.Register("pkg/sentry/fs/proc.ioData", (*ioData)(nil), state.Fns{Save: (*ioData).save, Load: (*ioData).load}) - state.Register("pkg/sentry/fs/proc.comm", (*comm)(nil), state.Fns{Save: (*comm).save, Load: (*comm).load}) - state.Register("pkg/sentry/fs/proc.commFile", (*commFile)(nil), state.Fns{Save: (*commFile).save, Load: (*commFile).load}) - state.Register("pkg/sentry/fs/proc.auxvec", (*auxvec)(nil), state.Fns{Save: (*auxvec).save, Load: (*auxvec).load}) - state.Register("pkg/sentry/fs/proc.auxvecFile", (*auxvecFile)(nil), state.Fns{Save: (*auxvecFile).save, Load: (*auxvecFile).load}) - state.Register("pkg/sentry/fs/proc.oomScoreAdj", (*oomScoreAdj)(nil), state.Fns{Save: (*oomScoreAdj).save, Load: (*oomScoreAdj).load}) - state.Register("pkg/sentry/fs/proc.oomScoreAdjFile", (*oomScoreAdjFile)(nil), state.Fns{Save: (*oomScoreAdjFile).save, Load: (*oomScoreAdjFile).load}) - state.Register("pkg/sentry/fs/proc.idMapInodeOperations", (*idMapInodeOperations)(nil), state.Fns{Save: (*idMapInodeOperations).save, Load: (*idMapInodeOperations).load}) - state.Register("pkg/sentry/fs/proc.idMapFileOperations", (*idMapFileOperations)(nil), state.Fns{Save: (*idMapFileOperations).save, Load: (*idMapFileOperations).load}) - state.Register("pkg/sentry/fs/proc.uptime", (*uptime)(nil), state.Fns{Save: (*uptime).save, Load: (*uptime).load}) - state.Register("pkg/sentry/fs/proc.uptimeFile", (*uptimeFile)(nil), state.Fns{Save: (*uptimeFile).save, Load: (*uptimeFile).load}) - state.Register("pkg/sentry/fs/proc.versionData", (*versionData)(nil), state.Fns{Save: (*versionData).save, Load: (*versionData).load}) + state.Register((*execArgInode)(nil)) + state.Register((*execArgFile)(nil)) + state.Register((*fdDir)(nil)) + state.Register((*fdDirFile)(nil)) + state.Register((*fdInfoDir)(nil)) + state.Register((*filesystemsData)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*taskOwnedInodeOps)(nil)) + state.Register((*staticFileInodeOps)(nil)) + state.Register((*loadavgData)(nil)) + state.Register((*meminfoData)(nil)) + state.Register((*mountInfoFile)(nil)) + state.Register((*mountsFile)(nil)) + state.Register((*ifinet6)(nil)) + state.Register((*netDev)(nil)) + state.Register((*netSnmp)(nil)) + state.Register((*netRoute)(nil)) + state.Register((*netUnix)(nil)) + state.Register((*netTCP)(nil)) + state.Register((*netTCP6)(nil)) + state.Register((*netUDP)(nil)) + state.Register((*proc)(nil)) + state.Register((*self)(nil)) + state.Register((*threadSelf)(nil)) + state.Register((*rootProcFile)(nil)) + state.Register((*statData)(nil)) + state.Register((*mmapMinAddrData)(nil)) + state.Register((*overcommitMemory)(nil)) + state.Register((*hostname)(nil)) + state.Register((*hostnameFile)(nil)) + state.Register((*tcpMemInode)(nil)) + state.Register((*tcpMemFile)(nil)) + state.Register((*tcpSack)(nil)) + state.Register((*tcpSackFile)(nil)) + state.Register((*taskDir)(nil)) + state.Register((*subtasks)(nil)) + state.Register((*subtasksFile)(nil)) + state.Register((*exe)(nil)) + state.Register((*namespaceSymlink)(nil)) + state.Register((*mapsData)(nil)) + state.Register((*smapsData)(nil)) + state.Register((*taskStatData)(nil)) + state.Register((*statmData)(nil)) + state.Register((*statusData)(nil)) + state.Register((*ioData)(nil)) + state.Register((*comm)(nil)) + state.Register((*commFile)(nil)) + state.Register((*auxvec)(nil)) + state.Register((*auxvecFile)(nil)) + state.Register((*oomScoreAdj)(nil)) + state.Register((*oomScoreAdjFile)(nil)) + state.Register((*idMapInodeOperations)(nil)) + state.Register((*idMapFileOperations)(nil)) + state.Register((*uptime)(nil)) + state.Register((*uptimeFile)(nil)) + state.Register((*versionData)(nil)) } diff --git a/pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go b/pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go index cfd3a40b4..6f48a944a 100644 --- a/pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go +++ b/pkg/sentry/fs/proc/seqfile/seqfile_state_autogen.go @@ -6,53 +6,95 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SeqData) StateTypeName() string { + return "pkg/sentry/fs/proc/seqfile.SeqData" +} + +func (x *SeqData) StateFields() []string { + return []string{ + "Buf", + "Handle", + } +} + func (x *SeqData) beforeSave() {} -func (x *SeqData) save(m state.Map) { + +func (x *SeqData) StateSave(m state.Sink) { x.beforeSave() - m.Save("Buf", &x.Buf) - m.Save("Handle", &x.Handle) + m.Save(0, &x.Buf) + m.Save(1, &x.Handle) } func (x *SeqData) afterLoad() {} -func (x *SeqData) load(m state.Map) { - m.Load("Buf", &x.Buf) - m.Load("Handle", &x.Handle) + +func (x *SeqData) StateLoad(m state.Source) { + m.Load(0, &x.Buf) + m.Load(1, &x.Handle) +} + +func (x *SeqFile) StateTypeName() string { + return "pkg/sentry/fs/proc/seqfile.SeqFile" +} + +func (x *SeqFile) StateFields() []string { + return []string{ + "InodeSimpleExtendedAttributes", + "InodeSimpleAttributes", + "SeqSource", + "source", + "generation", + "lastRead", + } } func (x *SeqFile) beforeSave() {} -func (x *SeqFile) save(m state.Map) { + +func (x *SeqFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("SeqSource", &x.SeqSource) - m.Save("source", &x.source) - m.Save("generation", &x.generation) - m.Save("lastRead", &x.lastRead) + m.Save(0, &x.InodeSimpleExtendedAttributes) + m.Save(1, &x.InodeSimpleAttributes) + m.Save(2, &x.SeqSource) + m.Save(3, &x.source) + m.Save(4, &x.generation) + m.Save(5, &x.lastRead) } func (x *SeqFile) afterLoad() {} -func (x *SeqFile) load(m state.Map) { - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("SeqSource", &x.SeqSource) - m.Load("source", &x.source) - m.Load("generation", &x.generation) - m.Load("lastRead", &x.lastRead) + +func (x *SeqFile) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleExtendedAttributes) + m.Load(1, &x.InodeSimpleAttributes) + m.Load(2, &x.SeqSource) + m.Load(3, &x.source) + m.Load(4, &x.generation) + m.Load(5, &x.lastRead) +} + +func (x *seqFileOperations) StateTypeName() string { + return "pkg/sentry/fs/proc/seqfile.seqFileOperations" +} + +func (x *seqFileOperations) StateFields() []string { + return []string{ + "seqFile", + } } func (x *seqFileOperations) beforeSave() {} -func (x *seqFileOperations) save(m state.Map) { + +func (x *seqFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("seqFile", &x.seqFile) + m.Save(0, &x.seqFile) } func (x *seqFileOperations) afterLoad() {} -func (x *seqFileOperations) load(m state.Map) { - m.Load("seqFile", &x.seqFile) + +func (x *seqFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.seqFile) } func init() { - state.Register("pkg/sentry/fs/proc/seqfile.SeqData", (*SeqData)(nil), state.Fns{Save: (*SeqData).save, Load: (*SeqData).load}) - state.Register("pkg/sentry/fs/proc/seqfile.SeqFile", (*SeqFile)(nil), state.Fns{Save: (*SeqFile).save, Load: (*SeqFile).load}) - state.Register("pkg/sentry/fs/proc/seqfile.seqFileOperations", (*seqFileOperations)(nil), state.Fns{Save: (*seqFileOperations).save, Load: (*seqFileOperations).load}) + state.Register((*SeqData)(nil)) + state.Register((*SeqFile)(nil)) + state.Register((*seqFileOperations)(nil)) } diff --git a/pkg/sentry/fs/ramfs/ramfs_state_autogen.go b/pkg/sentry/fs/ramfs/ramfs_state_autogen.go index 0a001e0b6..bfa355c84 100644 --- a/pkg/sentry/fs/ramfs/ramfs_state_autogen.go +++ b/pkg/sentry/fs/ramfs/ramfs_state_autogen.go @@ -6,89 +6,165 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Dir) StateTypeName() string { + return "pkg/sentry/fs/ramfs.Dir" +} + +func (x *Dir) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeSimpleExtendedAttributes", + "children", + "dentryMap", + } +} + func (x *Dir) beforeSave() {} -func (x *Dir) save(m state.Map) { + +func (x *Dir) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("children", &x.children) - m.Save("dentryMap", &x.dentryMap) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeSimpleExtendedAttributes) + m.Save(2, &x.children) + m.Save(3, &x.dentryMap) } func (x *Dir) afterLoad() {} -func (x *Dir) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("children", &x.children) - m.Load("dentryMap", &x.dentryMap) + +func (x *Dir) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeSimpleExtendedAttributes) + m.Load(2, &x.children) + m.Load(3, &x.dentryMap) +} + +func (x *dirFileOperations) StateTypeName() string { + return "pkg/sentry/fs/ramfs.dirFileOperations" +} + +func (x *dirFileOperations) StateFields() []string { + return []string{ + "dirCursor", + "dir", + } } func (x *dirFileOperations) beforeSave() {} -func (x *dirFileOperations) save(m state.Map) { + +func (x *dirFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("dirCursor", &x.dirCursor) - m.Save("dir", &x.dir) + m.Save(0, &x.dirCursor) + m.Save(1, &x.dir) } func (x *dirFileOperations) afterLoad() {} -func (x *dirFileOperations) load(m state.Map) { - m.Load("dirCursor", &x.dirCursor) - m.Load("dir", &x.dir) + +func (x *dirFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.dirCursor) + m.Load(1, &x.dir) +} + +func (x *Socket) StateTypeName() string { + return "pkg/sentry/fs/ramfs.Socket" +} + +func (x *Socket) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeSimpleExtendedAttributes", + "ep", + } } func (x *Socket) beforeSave() {} -func (x *Socket) save(m state.Map) { + +func (x *Socket) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("ep", &x.ep) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeSimpleExtendedAttributes) + m.Save(2, &x.ep) } func (x *Socket) afterLoad() {} -func (x *Socket) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("ep", &x.ep) + +func (x *Socket) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeSimpleExtendedAttributes) + m.Load(2, &x.ep) +} + +func (x *socketFileOperations) StateTypeName() string { + return "pkg/sentry/fs/ramfs.socketFileOperations" +} + +func (x *socketFileOperations) StateFields() []string { + return []string{} } func (x *socketFileOperations) beforeSave() {} -func (x *socketFileOperations) save(m state.Map) { + +func (x *socketFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *socketFileOperations) afterLoad() {} -func (x *socketFileOperations) load(m state.Map) { + +func (x *socketFileOperations) StateLoad(m state.Source) { +} + +func (x *Symlink) StateTypeName() string { + return "pkg/sentry/fs/ramfs.Symlink" +} + +func (x *Symlink) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeSimpleExtendedAttributes", + "Target", + } } func (x *Symlink) beforeSave() {} -func (x *Symlink) save(m state.Map) { + +func (x *Symlink) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("Target", &x.Target) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeSimpleExtendedAttributes) + m.Save(2, &x.Target) } func (x *Symlink) afterLoad() {} -func (x *Symlink) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("Target", &x.Target) + +func (x *Symlink) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeSimpleExtendedAttributes) + m.Load(2, &x.Target) +} + +func (x *symlinkFileOperations) StateTypeName() string { + return "pkg/sentry/fs/ramfs.symlinkFileOperations" +} + +func (x *symlinkFileOperations) StateFields() []string { + return []string{} } func (x *symlinkFileOperations) beforeSave() {} -func (x *symlinkFileOperations) save(m state.Map) { + +func (x *symlinkFileOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *symlinkFileOperations) afterLoad() {} -func (x *symlinkFileOperations) load(m state.Map) { + +func (x *symlinkFileOperations) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/fs/ramfs.Dir", (*Dir)(nil), state.Fns{Save: (*Dir).save, Load: (*Dir).load}) - state.Register("pkg/sentry/fs/ramfs.dirFileOperations", (*dirFileOperations)(nil), state.Fns{Save: (*dirFileOperations).save, Load: (*dirFileOperations).load}) - state.Register("pkg/sentry/fs/ramfs.Socket", (*Socket)(nil), state.Fns{Save: (*Socket).save, Load: (*Socket).load}) - state.Register("pkg/sentry/fs/ramfs.socketFileOperations", (*socketFileOperations)(nil), state.Fns{Save: (*socketFileOperations).save, Load: (*socketFileOperations).load}) - state.Register("pkg/sentry/fs/ramfs.Symlink", (*Symlink)(nil), state.Fns{Save: (*Symlink).save, Load: (*Symlink).load}) - state.Register("pkg/sentry/fs/ramfs.symlinkFileOperations", (*symlinkFileOperations)(nil), state.Fns{Save: (*symlinkFileOperations).save, Load: (*symlinkFileOperations).load}) + state.Register((*Dir)(nil)) + state.Register((*dirFileOperations)(nil)) + state.Register((*Socket)(nil)) + state.Register((*socketFileOperations)(nil)) + state.Register((*Symlink)(nil)) + state.Register((*symlinkFileOperations)(nil)) } diff --git a/pkg/sentry/fs/sys/sys_state_autogen.go b/pkg/sentry/fs/sys/sys_state_autogen.go index 733c504b1..71e08a167 100644 --- a/pkg/sentry/fs/sys/sys_state_autogen.go +++ b/pkg/sentry/fs/sys/sys_state_autogen.go @@ -6,29 +6,52 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *cpunum) StateTypeName() string { + return "pkg/sentry/fs/sys.cpunum" +} + +func (x *cpunum) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "InodeStaticFileGetter", + } +} + func (x *cpunum) beforeSave() {} -func (x *cpunum) save(m state.Map) { + +func (x *cpunum) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("InodeStaticFileGetter", &x.InodeStaticFileGetter) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.InodeStaticFileGetter) } func (x *cpunum) afterLoad() {} -func (x *cpunum) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("InodeStaticFileGetter", &x.InodeStaticFileGetter) + +func (x *cpunum) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.InodeStaticFileGetter) +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/sys.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} } func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/fs/sys.cpunum", (*cpunum)(nil), state.Fns{Save: (*cpunum).save, Load: (*cpunum).load}) - state.Register("pkg/sentry/fs/sys.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) + state.Register((*cpunum)(nil)) + state.Register((*filesystem)(nil)) } diff --git a/pkg/sentry/fs/timerfd/timerfd_state_autogen.go b/pkg/sentry/fs/timerfd/timerfd_state_autogen.go index 955cf1d38..2a411ceab 100644 --- a/pkg/sentry/fs/timerfd/timerfd_state_autogen.go +++ b/pkg/sentry/fs/timerfd/timerfd_state_autogen.go @@ -6,22 +6,35 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *TimerOperations) StateTypeName() string { + return "pkg/sentry/fs/timerfd.TimerOperations" +} + +func (x *TimerOperations) StateFields() []string { + return []string{ + "timer", + "val", + } +} + func (x *TimerOperations) beforeSave() {} -func (x *TimerOperations) save(m state.Map) { + +func (x *TimerOperations) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.events) { - m.Failf("events is %#v, expected zero", &x.events) + state.Failf("events is %#v, expected zero", &x.events) } - m.Save("timer", &x.timer) - m.Save("val", &x.val) + m.Save(0, &x.timer) + m.Save(1, &x.val) } func (x *TimerOperations) afterLoad() {} -func (x *TimerOperations) load(m state.Map) { - m.Load("timer", &x.timer) - m.Load("val", &x.val) + +func (x *TimerOperations) StateLoad(m state.Source) { + m.Load(0, &x.timer) + m.Load(1, &x.val) } func init() { - state.Register("pkg/sentry/fs/timerfd.TimerOperations", (*TimerOperations)(nil), state.Fns{Save: (*TimerOperations).save, Load: (*TimerOperations).load}) + state.Register((*TimerOperations)(nil)) } diff --git a/pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go b/pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go index e4d2584fd..894d3679e 100644 --- a/pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go +++ b/pkg/sentry/fs/tmpfs/tmpfs_state_autogen.go @@ -6,103 +6,192 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *regularFileOperations) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.regularFileOperations" +} + +func (x *regularFileOperations) StateFields() []string { + return []string{ + "iops", + } +} + func (x *regularFileOperations) beforeSave() {} -func (x *regularFileOperations) save(m state.Map) { + +func (x *regularFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("iops", &x.iops) + m.Save(0, &x.iops) } func (x *regularFileOperations) afterLoad() {} -func (x *regularFileOperations) load(m state.Map) { - m.Load("iops", &x.iops) + +func (x *regularFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.iops) +} + +func (x *Filesystem) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Filesystem" +} + +func (x *Filesystem) StateFields() []string { + return []string{} } func (x *Filesystem) beforeSave() {} -func (x *Filesystem) save(m state.Map) { + +func (x *Filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *Filesystem) afterLoad() {} -func (x *Filesystem) load(m state.Map) { + +func (x *Filesystem) StateLoad(m state.Source) { +} + +func (x *fileInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.fileInodeOperations" +} + +func (x *fileInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleExtendedAttributes", + "kernel", + "memUsage", + "attr", + "mappings", + "writableMappingPages", + "data", + "seals", + } } func (x *fileInodeOperations) beforeSave() {} -func (x *fileInodeOperations) save(m state.Map) { + +func (x *fileInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Save("kernel", &x.kernel) - m.Save("memUsage", &x.memUsage) - m.Save("attr", &x.attr) - m.Save("mappings", &x.mappings) - m.Save("writableMappingPages", &x.writableMappingPages) - m.Save("data", &x.data) - m.Save("seals", &x.seals) + m.Save(0, &x.InodeSimpleExtendedAttributes) + m.Save(1, &x.kernel) + m.Save(2, &x.memUsage) + m.Save(3, &x.attr) + m.Save(4, &x.mappings) + m.Save(5, &x.writableMappingPages) + m.Save(6, &x.data) + m.Save(7, &x.seals) } func (x *fileInodeOperations) afterLoad() {} -func (x *fileInodeOperations) load(m state.Map) { - m.Load("InodeSimpleExtendedAttributes", &x.InodeSimpleExtendedAttributes) - m.Load("kernel", &x.kernel) - m.Load("memUsage", &x.memUsage) - m.Load("attr", &x.attr) - m.Load("mappings", &x.mappings) - m.Load("writableMappingPages", &x.writableMappingPages) - m.Load("data", &x.data) - m.Load("seals", &x.seals) + +func (x *fileInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleExtendedAttributes) + m.Load(1, &x.kernel) + m.Load(2, &x.memUsage) + m.Load(3, &x.attr) + m.Load(4, &x.mappings) + m.Load(5, &x.writableMappingPages) + m.Load(6, &x.data) + m.Load(7, &x.seals) +} + +func (x *Dir) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Dir" +} + +func (x *Dir) StateFields() []string { + return []string{ + "ramfsDir", + "kernel", + } } func (x *Dir) beforeSave() {} -func (x *Dir) save(m state.Map) { + +func (x *Dir) StateSave(m state.Sink) { x.beforeSave() - m.Save("ramfsDir", &x.ramfsDir) - m.Save("kernel", &x.kernel) + m.Save(0, &x.ramfsDir) + m.Save(1, &x.kernel) } -func (x *Dir) load(m state.Map) { - m.Load("ramfsDir", &x.ramfsDir) - m.Load("kernel", &x.kernel) +func (x *Dir) StateLoad(m state.Source) { + m.Load(0, &x.ramfsDir) + m.Load(1, &x.kernel) m.AfterLoad(x.afterLoad) } +func (x *Symlink) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Symlink" +} + +func (x *Symlink) StateFields() []string { + return []string{ + "Symlink", + } +} + func (x *Symlink) beforeSave() {} -func (x *Symlink) save(m state.Map) { + +func (x *Symlink) StateSave(m state.Sink) { x.beforeSave() - m.Save("Symlink", &x.Symlink) + m.Save(0, &x.Symlink) } func (x *Symlink) afterLoad() {} -func (x *Symlink) load(m state.Map) { - m.Load("Symlink", &x.Symlink) + +func (x *Symlink) StateLoad(m state.Source) { + m.Load(0, &x.Symlink) +} + +func (x *Socket) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Socket" +} + +func (x *Socket) StateFields() []string { + return []string{ + "Socket", + } } func (x *Socket) beforeSave() {} -func (x *Socket) save(m state.Map) { + +func (x *Socket) StateSave(m state.Sink) { x.beforeSave() - m.Save("Socket", &x.Socket) + m.Save(0, &x.Socket) } func (x *Socket) afterLoad() {} -func (x *Socket) load(m state.Map) { - m.Load("Socket", &x.Socket) + +func (x *Socket) StateLoad(m state.Source) { + m.Load(0, &x.Socket) +} + +func (x *Fifo) StateTypeName() string { + return "pkg/sentry/fs/tmpfs.Fifo" +} + +func (x *Fifo) StateFields() []string { + return []string{ + "InodeOperations", + } } func (x *Fifo) beforeSave() {} -func (x *Fifo) save(m state.Map) { + +func (x *Fifo) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeOperations", &x.InodeOperations) + m.Save(0, &x.InodeOperations) } func (x *Fifo) afterLoad() {} -func (x *Fifo) load(m state.Map) { - m.Load("InodeOperations", &x.InodeOperations) + +func (x *Fifo) StateLoad(m state.Source) { + m.Load(0, &x.InodeOperations) } func init() { - state.Register("pkg/sentry/fs/tmpfs.regularFileOperations", (*regularFileOperations)(nil), state.Fns{Save: (*regularFileOperations).save, Load: (*regularFileOperations).load}) - state.Register("pkg/sentry/fs/tmpfs.Filesystem", (*Filesystem)(nil), state.Fns{Save: (*Filesystem).save, Load: (*Filesystem).load}) - state.Register("pkg/sentry/fs/tmpfs.fileInodeOperations", (*fileInodeOperations)(nil), state.Fns{Save: (*fileInodeOperations).save, Load: (*fileInodeOperations).load}) - state.Register("pkg/sentry/fs/tmpfs.Dir", (*Dir)(nil), state.Fns{Save: (*Dir).save, Load: (*Dir).load}) - state.Register("pkg/sentry/fs/tmpfs.Symlink", (*Symlink)(nil), state.Fns{Save: (*Symlink).save, Load: (*Symlink).load}) - state.Register("pkg/sentry/fs/tmpfs.Socket", (*Socket)(nil), state.Fns{Save: (*Socket).save, Load: (*Socket).load}) - state.Register("pkg/sentry/fs/tmpfs.Fifo", (*Fifo)(nil), state.Fns{Save: (*Fifo).save, Load: (*Fifo).load}) + state.Register((*regularFileOperations)(nil)) + state.Register((*Filesystem)(nil)) + state.Register((*fileInodeOperations)(nil)) + state.Register((*Dir)(nil)) + state.Register((*Symlink)(nil)) + state.Register((*Socket)(nil)) + state.Register((*Fifo)(nil)) } diff --git a/pkg/sentry/fs/tty/tty_state_autogen.go b/pkg/sentry/fs/tty/tty_state_autogen.go index 25d601072..e82ca45a3 100644 --- a/pkg/sentry/fs/tty/tty_state_autogen.go +++ b/pkg/sentry/fs/tty/tty_state_autogen.go @@ -6,205 +6,376 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *dirInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.dirInodeOperations" +} + +func (x *dirInodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "msrc", + "master", + "slaves", + "dentryMap", + "next", + } +} + func (x *dirInodeOperations) beforeSave() {} -func (x *dirInodeOperations) save(m state.Map) { + +func (x *dirInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("msrc", &x.msrc) - m.Save("master", &x.master) - m.Save("slaves", &x.slaves) - m.Save("dentryMap", &x.dentryMap) - m.Save("next", &x.next) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.msrc) + m.Save(2, &x.master) + m.Save(3, &x.slaves) + m.Save(4, &x.dentryMap) + m.Save(5, &x.next) } func (x *dirInodeOperations) afterLoad() {} -func (x *dirInodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("msrc", &x.msrc) - m.Load("master", &x.master) - m.Load("slaves", &x.slaves) - m.Load("dentryMap", &x.dentryMap) - m.Load("next", &x.next) + +func (x *dirInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.msrc) + m.Load(2, &x.master) + m.Load(3, &x.slaves) + m.Load(4, &x.dentryMap) + m.Load(5, &x.next) +} + +func (x *dirFileOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.dirFileOperations" +} + +func (x *dirFileOperations) StateFields() []string { + return []string{ + "di", + "dirCursor", + } } func (x *dirFileOperations) beforeSave() {} -func (x *dirFileOperations) save(m state.Map) { + +func (x *dirFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("di", &x.di) - m.Save("dirCursor", &x.dirCursor) + m.Save(0, &x.di) + m.Save(1, &x.dirCursor) } func (x *dirFileOperations) afterLoad() {} -func (x *dirFileOperations) load(m state.Map) { - m.Load("di", &x.di) - m.Load("dirCursor", &x.dirCursor) + +func (x *dirFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.di) + m.Load(1, &x.dirCursor) +} + +func (x *filesystem) StateTypeName() string { + return "pkg/sentry/fs/tty.filesystem" +} + +func (x *filesystem) StateFields() []string { + return []string{} } func (x *filesystem) beforeSave() {} -func (x *filesystem) save(m state.Map) { + +func (x *filesystem) StateSave(m state.Sink) { x.beforeSave() } func (x *filesystem) afterLoad() {} -func (x *filesystem) load(m state.Map) { + +func (x *filesystem) StateLoad(m state.Source) { +} + +func (x *superOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.superOperations" +} + +func (x *superOperations) StateFields() []string { + return []string{} } func (x *superOperations) beforeSave() {} -func (x *superOperations) save(m state.Map) { + +func (x *superOperations) StateSave(m state.Sink) { x.beforeSave() } func (x *superOperations) afterLoad() {} -func (x *superOperations) load(m state.Map) { + +func (x *superOperations) StateLoad(m state.Source) { +} + +func (x *lineDiscipline) StateTypeName() string { + return "pkg/sentry/fs/tty.lineDiscipline" +} + +func (x *lineDiscipline) StateFields() []string { + return []string{ + "size", + "inQueue", + "outQueue", + "termios", + "column", + } } func (x *lineDiscipline) beforeSave() {} -func (x *lineDiscipline) save(m state.Map) { + +func (x *lineDiscipline) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.masterWaiter) { - m.Failf("masterWaiter is %#v, expected zero", &x.masterWaiter) + state.Failf("masterWaiter is %#v, expected zero", &x.masterWaiter) } if !state.IsZeroValue(&x.slaveWaiter) { - m.Failf("slaveWaiter is %#v, expected zero", &x.slaveWaiter) + state.Failf("slaveWaiter is %#v, expected zero", &x.slaveWaiter) } - m.Save("size", &x.size) - m.Save("inQueue", &x.inQueue) - m.Save("outQueue", &x.outQueue) - m.Save("termios", &x.termios) - m.Save("column", &x.column) + m.Save(0, &x.size) + m.Save(1, &x.inQueue) + m.Save(2, &x.outQueue) + m.Save(3, &x.termios) + m.Save(4, &x.column) } func (x *lineDiscipline) afterLoad() {} -func (x *lineDiscipline) load(m state.Map) { - m.Load("size", &x.size) - m.Load("inQueue", &x.inQueue) - m.Load("outQueue", &x.outQueue) - m.Load("termios", &x.termios) - m.Load("column", &x.column) + +func (x *lineDiscipline) StateLoad(m state.Source) { + m.Load(0, &x.size) + m.Load(1, &x.inQueue) + m.Load(2, &x.outQueue) + m.Load(3, &x.termios) + m.Load(4, &x.column) +} + +func (x *outputQueueTransformer) StateTypeName() string { + return "pkg/sentry/fs/tty.outputQueueTransformer" +} + +func (x *outputQueueTransformer) StateFields() []string { + return []string{} } func (x *outputQueueTransformer) beforeSave() {} -func (x *outputQueueTransformer) save(m state.Map) { + +func (x *outputQueueTransformer) StateSave(m state.Sink) { x.beforeSave() } func (x *outputQueueTransformer) afterLoad() {} -func (x *outputQueueTransformer) load(m state.Map) { + +func (x *outputQueueTransformer) StateLoad(m state.Source) { +} + +func (x *inputQueueTransformer) StateTypeName() string { + return "pkg/sentry/fs/tty.inputQueueTransformer" +} + +func (x *inputQueueTransformer) StateFields() []string { + return []string{} } func (x *inputQueueTransformer) beforeSave() {} -func (x *inputQueueTransformer) save(m state.Map) { + +func (x *inputQueueTransformer) StateSave(m state.Sink) { x.beforeSave() } func (x *inputQueueTransformer) afterLoad() {} -func (x *inputQueueTransformer) load(m state.Map) { + +func (x *inputQueueTransformer) StateLoad(m state.Source) { +} + +func (x *masterInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.masterInodeOperations" +} + +func (x *masterInodeOperations) StateFields() []string { + return []string{ + "SimpleFileInode", + "d", + } } func (x *masterInodeOperations) beforeSave() {} -func (x *masterInodeOperations) save(m state.Map) { + +func (x *masterInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("d", &x.d) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.d) } func (x *masterInodeOperations) afterLoad() {} -func (x *masterInodeOperations) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("d", &x.d) + +func (x *masterInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.d) +} + +func (x *masterFileOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.masterFileOperations" +} + +func (x *masterFileOperations) StateFields() []string { + return []string{ + "d", + "t", + } } func (x *masterFileOperations) beforeSave() {} -func (x *masterFileOperations) save(m state.Map) { + +func (x *masterFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("d", &x.d) - m.Save("t", &x.t) + m.Save(0, &x.d) + m.Save(1, &x.t) } func (x *masterFileOperations) afterLoad() {} -func (x *masterFileOperations) load(m state.Map) { - m.Load("d", &x.d) - m.Load("t", &x.t) + +func (x *masterFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.d) + m.Load(1, &x.t) +} + +func (x *queue) StateTypeName() string { + return "pkg/sentry/fs/tty.queue" +} + +func (x *queue) StateFields() []string { + return []string{ + "readBuf", + "waitBuf", + "waitBufLen", + "readable", + "transformer", + } } func (x *queue) beforeSave() {} -func (x *queue) save(m state.Map) { + +func (x *queue) StateSave(m state.Sink) { x.beforeSave() - m.Save("readBuf", &x.readBuf) - m.Save("waitBuf", &x.waitBuf) - m.Save("waitBufLen", &x.waitBufLen) - m.Save("readable", &x.readable) - m.Save("transformer", &x.transformer) + m.Save(0, &x.readBuf) + m.Save(1, &x.waitBuf) + m.Save(2, &x.waitBufLen) + m.Save(3, &x.readable) + m.Save(4, &x.transformer) } func (x *queue) afterLoad() {} -func (x *queue) load(m state.Map) { - m.Load("readBuf", &x.readBuf) - m.Load("waitBuf", &x.waitBuf) - m.Load("waitBufLen", &x.waitBufLen) - m.Load("readable", &x.readable) - m.Load("transformer", &x.transformer) + +func (x *queue) StateLoad(m state.Source) { + m.Load(0, &x.readBuf) + m.Load(1, &x.waitBuf) + m.Load(2, &x.waitBufLen) + m.Load(3, &x.readable) + m.Load(4, &x.transformer) +} + +func (x *slaveInodeOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.slaveInodeOperations" +} + +func (x *slaveInodeOperations) StateFields() []string { + return []string{ + "SimpleFileInode", + "d", + "t", + } } func (x *slaveInodeOperations) beforeSave() {} -func (x *slaveInodeOperations) save(m state.Map) { + +func (x *slaveInodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("SimpleFileInode", &x.SimpleFileInode) - m.Save("d", &x.d) - m.Save("t", &x.t) + m.Save(0, &x.SimpleFileInode) + m.Save(1, &x.d) + m.Save(2, &x.t) } func (x *slaveInodeOperations) afterLoad() {} -func (x *slaveInodeOperations) load(m state.Map) { - m.Load("SimpleFileInode", &x.SimpleFileInode) - m.Load("d", &x.d) - m.Load("t", &x.t) + +func (x *slaveInodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.SimpleFileInode) + m.Load(1, &x.d) + m.Load(2, &x.t) +} + +func (x *slaveFileOperations) StateTypeName() string { + return "pkg/sentry/fs/tty.slaveFileOperations" +} + +func (x *slaveFileOperations) StateFields() []string { + return []string{ + "si", + } } func (x *slaveFileOperations) beforeSave() {} -func (x *slaveFileOperations) save(m state.Map) { + +func (x *slaveFileOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("si", &x.si) + m.Save(0, &x.si) } func (x *slaveFileOperations) afterLoad() {} -func (x *slaveFileOperations) load(m state.Map) { - m.Load("si", &x.si) + +func (x *slaveFileOperations) StateLoad(m state.Source) { + m.Load(0, &x.si) +} + +func (x *Terminal) StateTypeName() string { + return "pkg/sentry/fs/tty.Terminal" +} + +func (x *Terminal) StateFields() []string { + return []string{ + "AtomicRefCount", + "n", + "d", + "ld", + "masterKTTY", + "slaveKTTY", + } } func (x *Terminal) beforeSave() {} -func (x *Terminal) save(m state.Map) { + +func (x *Terminal) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("n", &x.n) - m.Save("d", &x.d) - m.Save("ld", &x.ld) - m.Save("masterKTTY", &x.masterKTTY) - m.Save("slaveKTTY", &x.slaveKTTY) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.n) + m.Save(2, &x.d) + m.Save(3, &x.ld) + m.Save(4, &x.masterKTTY) + m.Save(5, &x.slaveKTTY) } func (x *Terminal) afterLoad() {} -func (x *Terminal) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("n", &x.n) - m.Load("d", &x.d) - m.Load("ld", &x.ld) - m.Load("masterKTTY", &x.masterKTTY) - m.Load("slaveKTTY", &x.slaveKTTY) + +func (x *Terminal) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.n) + m.Load(2, &x.d) + m.Load(3, &x.ld) + m.Load(4, &x.masterKTTY) + m.Load(5, &x.slaveKTTY) } func init() { - state.Register("pkg/sentry/fs/tty.dirInodeOperations", (*dirInodeOperations)(nil), state.Fns{Save: (*dirInodeOperations).save, Load: (*dirInodeOperations).load}) - state.Register("pkg/sentry/fs/tty.dirFileOperations", (*dirFileOperations)(nil), state.Fns{Save: (*dirFileOperations).save, Load: (*dirFileOperations).load}) - state.Register("pkg/sentry/fs/tty.filesystem", (*filesystem)(nil), state.Fns{Save: (*filesystem).save, Load: (*filesystem).load}) - state.Register("pkg/sentry/fs/tty.superOperations", (*superOperations)(nil), state.Fns{Save: (*superOperations).save, Load: (*superOperations).load}) - state.Register("pkg/sentry/fs/tty.lineDiscipline", (*lineDiscipline)(nil), state.Fns{Save: (*lineDiscipline).save, Load: (*lineDiscipline).load}) - state.Register("pkg/sentry/fs/tty.outputQueueTransformer", (*outputQueueTransformer)(nil), state.Fns{Save: (*outputQueueTransformer).save, Load: (*outputQueueTransformer).load}) - state.Register("pkg/sentry/fs/tty.inputQueueTransformer", (*inputQueueTransformer)(nil), state.Fns{Save: (*inputQueueTransformer).save, Load: (*inputQueueTransformer).load}) - state.Register("pkg/sentry/fs/tty.masterInodeOperations", (*masterInodeOperations)(nil), state.Fns{Save: (*masterInodeOperations).save, Load: (*masterInodeOperations).load}) - state.Register("pkg/sentry/fs/tty.masterFileOperations", (*masterFileOperations)(nil), state.Fns{Save: (*masterFileOperations).save, Load: (*masterFileOperations).load}) - state.Register("pkg/sentry/fs/tty.queue", (*queue)(nil), state.Fns{Save: (*queue).save, Load: (*queue).load}) - state.Register("pkg/sentry/fs/tty.slaveInodeOperations", (*slaveInodeOperations)(nil), state.Fns{Save: (*slaveInodeOperations).save, Load: (*slaveInodeOperations).load}) - state.Register("pkg/sentry/fs/tty.slaveFileOperations", (*slaveFileOperations)(nil), state.Fns{Save: (*slaveFileOperations).save, Load: (*slaveFileOperations).load}) - state.Register("pkg/sentry/fs/tty.Terminal", (*Terminal)(nil), state.Fns{Save: (*Terminal).save, Load: (*Terminal).load}) + state.Register((*dirInodeOperations)(nil)) + state.Register((*dirFileOperations)(nil)) + state.Register((*filesystem)(nil)) + state.Register((*superOperations)(nil)) + state.Register((*lineDiscipline)(nil)) + state.Register((*outputQueueTransformer)(nil)) + state.Register((*inputQueueTransformer)(nil)) + state.Register((*masterInodeOperations)(nil)) + state.Register((*masterFileOperations)(nil)) + state.Register((*queue)(nil)) + state.Register((*slaveInodeOperations)(nil)) + state.Register((*slaveFileOperations)(nil)) + state.Register((*Terminal)(nil)) } diff --git a/pkg/sentry/fsbridge/fsbridge_state_autogen.go b/pkg/sentry/fsbridge/fsbridge_state_autogen.go index d370b2d47..d69b50c28 100644 --- a/pkg/sentry/fsbridge/fsbridge_state_autogen.go +++ b/pkg/sentry/fsbridge/fsbridge_state_autogen.go @@ -6,61 +6,113 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *fsFile) StateTypeName() string { + return "pkg/sentry/fsbridge.fsFile" +} + +func (x *fsFile) StateFields() []string { + return []string{ + "file", + } +} + func (x *fsFile) beforeSave() {} -func (x *fsFile) save(m state.Map) { + +func (x *fsFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("file", &x.file) + m.Save(0, &x.file) } func (x *fsFile) afterLoad() {} -func (x *fsFile) load(m state.Map) { - m.Load("file", &x.file) + +func (x *fsFile) StateLoad(m state.Source) { + m.Load(0, &x.file) +} + +func (x *fsLookup) StateTypeName() string { + return "pkg/sentry/fsbridge.fsLookup" +} + +func (x *fsLookup) StateFields() []string { + return []string{ + "mntns", + "root", + "workingDir", + } } func (x *fsLookup) beforeSave() {} -func (x *fsLookup) save(m state.Map) { + +func (x *fsLookup) StateSave(m state.Sink) { x.beforeSave() - m.Save("mntns", &x.mntns) - m.Save("root", &x.root) - m.Save("workingDir", &x.workingDir) + m.Save(0, &x.mntns) + m.Save(1, &x.root) + m.Save(2, &x.workingDir) } func (x *fsLookup) afterLoad() {} -func (x *fsLookup) load(m state.Map) { - m.Load("mntns", &x.mntns) - m.Load("root", &x.root) - m.Load("workingDir", &x.workingDir) + +func (x *fsLookup) StateLoad(m state.Source) { + m.Load(0, &x.mntns) + m.Load(1, &x.root) + m.Load(2, &x.workingDir) +} + +func (x *VFSFile) StateTypeName() string { + return "pkg/sentry/fsbridge.VFSFile" +} + +func (x *VFSFile) StateFields() []string { + return []string{ + "file", + } } func (x *VFSFile) beforeSave() {} -func (x *VFSFile) save(m state.Map) { + +func (x *VFSFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("file", &x.file) + m.Save(0, &x.file) } func (x *VFSFile) afterLoad() {} -func (x *VFSFile) load(m state.Map) { - m.Load("file", &x.file) + +func (x *VFSFile) StateLoad(m state.Source) { + m.Load(0, &x.file) +} + +func (x *vfsLookup) StateTypeName() string { + return "pkg/sentry/fsbridge.vfsLookup" +} + +func (x *vfsLookup) StateFields() []string { + return []string{ + "mntns", + "root", + "workingDir", + } } func (x *vfsLookup) beforeSave() {} -func (x *vfsLookup) save(m state.Map) { + +func (x *vfsLookup) StateSave(m state.Sink) { x.beforeSave() - m.Save("mntns", &x.mntns) - m.Save("root", &x.root) - m.Save("workingDir", &x.workingDir) + m.Save(0, &x.mntns) + m.Save(1, &x.root) + m.Save(2, &x.workingDir) } func (x *vfsLookup) afterLoad() {} -func (x *vfsLookup) load(m state.Map) { - m.Load("mntns", &x.mntns) - m.Load("root", &x.root) - m.Load("workingDir", &x.workingDir) + +func (x *vfsLookup) StateLoad(m state.Source) { + m.Load(0, &x.mntns) + m.Load(1, &x.root) + m.Load(2, &x.workingDir) } func init() { - state.Register("pkg/sentry/fsbridge.fsFile", (*fsFile)(nil), state.Fns{Save: (*fsFile).save, Load: (*fsFile).load}) - state.Register("pkg/sentry/fsbridge.fsLookup", (*fsLookup)(nil), state.Fns{Save: (*fsLookup).save, Load: (*fsLookup).load}) - state.Register("pkg/sentry/fsbridge.VFSFile", (*VFSFile)(nil), state.Fns{Save: (*VFSFile).save, Load: (*VFSFile).load}) - state.Register("pkg/sentry/fsbridge.vfsLookup", (*vfsLookup)(nil), state.Fns{Save: (*vfsLookup).save, Load: (*vfsLookup).load}) + state.Register((*fsFile)(nil)) + state.Register((*fsLookup)(nil)) + state.Register((*VFSFile)(nil)) + state.Register((*vfsLookup)(nil)) } diff --git a/pkg/sentry/fsimpl/devpts/devpts_state_autogen.go b/pkg/sentry/fsimpl/devpts/devpts_state_autogen.go index 90cd7937c..5942f7bac 100644 --- a/pkg/sentry/fsimpl/devpts/devpts_state_autogen.go +++ b/pkg/sentry/fsimpl/devpts/devpts_state_autogen.go @@ -6,89 +6,156 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *lineDiscipline) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.lineDiscipline" +} + +func (x *lineDiscipline) StateFields() []string { + return []string{ + "size", + "inQueue", + "outQueue", + "termios", + "column", + } +} + func (x *lineDiscipline) beforeSave() {} -func (x *lineDiscipline) save(m state.Map) { + +func (x *lineDiscipline) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.masterWaiter) { - m.Failf("masterWaiter is %#v, expected zero", &x.masterWaiter) + state.Failf("masterWaiter is %#v, expected zero", &x.masterWaiter) } if !state.IsZeroValue(&x.slaveWaiter) { - m.Failf("slaveWaiter is %#v, expected zero", &x.slaveWaiter) + state.Failf("slaveWaiter is %#v, expected zero", &x.slaveWaiter) } - m.Save("size", &x.size) - m.Save("inQueue", &x.inQueue) - m.Save("outQueue", &x.outQueue) - m.Save("termios", &x.termios) - m.Save("column", &x.column) + m.Save(0, &x.size) + m.Save(1, &x.inQueue) + m.Save(2, &x.outQueue) + m.Save(3, &x.termios) + m.Save(4, &x.column) } func (x *lineDiscipline) afterLoad() {} -func (x *lineDiscipline) load(m state.Map) { - m.Load("size", &x.size) - m.Load("inQueue", &x.inQueue) - m.Load("outQueue", &x.outQueue) - m.Load("termios", &x.termios) - m.Load("column", &x.column) + +func (x *lineDiscipline) StateLoad(m state.Source) { + m.Load(0, &x.size) + m.Load(1, &x.inQueue) + m.Load(2, &x.outQueue) + m.Load(3, &x.termios) + m.Load(4, &x.column) +} + +func (x *outputQueueTransformer) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.outputQueueTransformer" +} + +func (x *outputQueueTransformer) StateFields() []string { + return []string{} } func (x *outputQueueTransformer) beforeSave() {} -func (x *outputQueueTransformer) save(m state.Map) { + +func (x *outputQueueTransformer) StateSave(m state.Sink) { x.beforeSave() } func (x *outputQueueTransformer) afterLoad() {} -func (x *outputQueueTransformer) load(m state.Map) { + +func (x *outputQueueTransformer) StateLoad(m state.Source) { +} + +func (x *inputQueueTransformer) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.inputQueueTransformer" +} + +func (x *inputQueueTransformer) StateFields() []string { + return []string{} } func (x *inputQueueTransformer) beforeSave() {} -func (x *inputQueueTransformer) save(m state.Map) { + +func (x *inputQueueTransformer) StateSave(m state.Sink) { x.beforeSave() } func (x *inputQueueTransformer) afterLoad() {} -func (x *inputQueueTransformer) load(m state.Map) { + +func (x *inputQueueTransformer) StateLoad(m state.Source) { +} + +func (x *queue) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.queue" +} + +func (x *queue) StateFields() []string { + return []string{ + "readBuf", + "waitBuf", + "waitBufLen", + "readable", + "transformer", + } } func (x *queue) beforeSave() {} -func (x *queue) save(m state.Map) { + +func (x *queue) StateSave(m state.Sink) { x.beforeSave() - m.Save("readBuf", &x.readBuf) - m.Save("waitBuf", &x.waitBuf) - m.Save("waitBufLen", &x.waitBufLen) - m.Save("readable", &x.readable) - m.Save("transformer", &x.transformer) + m.Save(0, &x.readBuf) + m.Save(1, &x.waitBuf) + m.Save(2, &x.waitBufLen) + m.Save(3, &x.readable) + m.Save(4, &x.transformer) } func (x *queue) afterLoad() {} -func (x *queue) load(m state.Map) { - m.Load("readBuf", &x.readBuf) - m.Load("waitBuf", &x.waitBuf) - m.Load("waitBufLen", &x.waitBufLen) - m.Load("readable", &x.readable) - m.Load("transformer", &x.transformer) + +func (x *queue) StateLoad(m state.Source) { + m.Load(0, &x.readBuf) + m.Load(1, &x.waitBuf) + m.Load(2, &x.waitBufLen) + m.Load(3, &x.readable) + m.Load(4, &x.transformer) +} + +func (x *Terminal) StateTypeName() string { + return "pkg/sentry/fsimpl/devpts.Terminal" +} + +func (x *Terminal) StateFields() []string { + return []string{ + "n", + "ld", + "masterKTTY", + "slaveKTTY", + } } func (x *Terminal) beforeSave() {} -func (x *Terminal) save(m state.Map) { + +func (x *Terminal) StateSave(m state.Sink) { x.beforeSave() - m.Save("n", &x.n) - m.Save("ld", &x.ld) - m.Save("masterKTTY", &x.masterKTTY) - m.Save("slaveKTTY", &x.slaveKTTY) + m.Save(0, &x.n) + m.Save(1, &x.ld) + m.Save(2, &x.masterKTTY) + m.Save(3, &x.slaveKTTY) } func (x *Terminal) afterLoad() {} -func (x *Terminal) load(m state.Map) { - m.Load("n", &x.n) - m.Load("ld", &x.ld) - m.Load("masterKTTY", &x.masterKTTY) - m.Load("slaveKTTY", &x.slaveKTTY) + +func (x *Terminal) StateLoad(m state.Source) { + m.Load(0, &x.n) + m.Load(1, &x.ld) + m.Load(2, &x.masterKTTY) + m.Load(3, &x.slaveKTTY) } func init() { - state.Register("pkg/sentry/fsimpl/devpts.lineDiscipline", (*lineDiscipline)(nil), state.Fns{Save: (*lineDiscipline).save, Load: (*lineDiscipline).load}) - state.Register("pkg/sentry/fsimpl/devpts.outputQueueTransformer", (*outputQueueTransformer)(nil), state.Fns{Save: (*outputQueueTransformer).save, Load: (*outputQueueTransformer).load}) - state.Register("pkg/sentry/fsimpl/devpts.inputQueueTransformer", (*inputQueueTransformer)(nil), state.Fns{Save: (*inputQueueTransformer).save, Load: (*inputQueueTransformer).load}) - state.Register("pkg/sentry/fsimpl/devpts.queue", (*queue)(nil), state.Fns{Save: (*queue).save, Load: (*queue).load}) - state.Register("pkg/sentry/fsimpl/devpts.Terminal", (*Terminal)(nil), state.Fns{Save: (*Terminal).save, Load: (*Terminal).load}) + state.Register((*lineDiscipline)(nil)) + state.Register((*outputQueueTransformer)(nil)) + state.Register((*inputQueueTransformer)(nil)) + state.Register((*queue)(nil)) + state.Register((*Terminal)(nil)) } diff --git a/pkg/sentry/fsimpl/gofer/dentry_list.go b/pkg/sentry/fsimpl/gofer/dentry_list.go index fa03e2501..84f839e3a 100644 --- a/pkg/sentry/fsimpl/gofer/dentry_list.go +++ b/pkg/sentry/fsimpl/gofer/dentry_list.go @@ -56,7 +56,7 @@ func (l *dentryList) Back() *dentry { // // NOTE: This is an O(n) operation. func (l *dentryList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (dentryElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *dentryList) Remove(e *dentry) { if prev != nil { dentryElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { dentryElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/fsimpl/gofer/gofer_state_autogen.go b/pkg/sentry/fsimpl/gofer/gofer_state_autogen.go index 546d432c9..19b1eef9e 100644 --- a/pkg/sentry/fsimpl/gofer/gofer_state_autogen.go +++ b/pkg/sentry/fsimpl/gofer/gofer_state_autogen.go @@ -6,33 +6,59 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *dentryList) StateTypeName() string { + return "pkg/sentry/fsimpl/gofer.dentryList" +} + +func (x *dentryList) StateFields() []string { + return []string{ + "head", + "tail", + } +} + func (x *dentryList) beforeSave() {} -func (x *dentryList) save(m state.Map) { + +func (x *dentryList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *dentryList) afterLoad() {} -func (x *dentryList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *dentryList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *dentryEntry) StateTypeName() string { + return "pkg/sentry/fsimpl/gofer.dentryEntry" +} + +func (x *dentryEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *dentryEntry) beforeSave() {} -func (x *dentryEntry) save(m state.Map) { + +func (x *dentryEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *dentryEntry) afterLoad() {} -func (x *dentryEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *dentryEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) } func init() { - state.Register("pkg/sentry/fsimpl/gofer.dentryList", (*dentryList)(nil), state.Fns{Save: (*dentryList).save, Load: (*dentryList).load}) - state.Register("pkg/sentry/fsimpl/gofer.dentryEntry", (*dentryEntry)(nil), state.Fns{Save: (*dentryEntry).save, Load: (*dentryEntry).load}) + state.Register((*dentryList)(nil)) + state.Register((*dentryEntry)(nil)) } diff --git a/pkg/sentry/fsimpl/host/host_state_autogen.go b/pkg/sentry/fsimpl/host/host_state_autogen.go index 28bc79d04..17320c417 100644 --- a/pkg/sentry/fsimpl/host/host_state_autogen.go +++ b/pkg/sentry/fsimpl/host/host_state_autogen.go @@ -6,23 +6,38 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *ConnectedEndpoint) StateTypeName() string { + return "pkg/sentry/fsimpl/host.ConnectedEndpoint" +} + +func (x *ConnectedEndpoint) StateFields() []string { + return []string{ + "ref", + "fd", + "addr", + "stype", + } +} + func (x *ConnectedEndpoint) beforeSave() {} -func (x *ConnectedEndpoint) save(m state.Map) { + +func (x *ConnectedEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("ref", &x.ref) - m.Save("fd", &x.fd) - m.Save("addr", &x.addr) - m.Save("stype", &x.stype) + m.Save(0, &x.ref) + m.Save(1, &x.fd) + m.Save(2, &x.addr) + m.Save(3, &x.stype) } func (x *ConnectedEndpoint) afterLoad() {} -func (x *ConnectedEndpoint) load(m state.Map) { - m.Load("ref", &x.ref) - m.Load("fd", &x.fd) - m.Load("addr", &x.addr) - m.Load("stype", &x.stype) + +func (x *ConnectedEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.ref) + m.Load(1, &x.fd) + m.Load(2, &x.addr) + m.Load(3, &x.stype) } func init() { - state.Register("pkg/sentry/fsimpl/host.ConnectedEndpoint", (*ConnectedEndpoint)(nil), state.Fns{Save: (*ConnectedEndpoint).save, Load: (*ConnectedEndpoint).load}) + state.Register((*ConnectedEndpoint)(nil)) } diff --git a/pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go b/pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go index 61b2c460f..371b1481c 100644 --- a/pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go +++ b/pkg/sentry/fsimpl/kernfs/kernfs_state_autogen.go @@ -6,97 +6,173 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *DynamicBytesFile) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.DynamicBytesFile" +} + +func (x *DynamicBytesFile) StateFields() []string { + return []string{ + "InodeAttrs", + "InodeNoopRefCount", + "InodeNotDirectory", + "InodeNotSymlink", + "locks", + "data", + } +} + func (x *DynamicBytesFile) beforeSave() {} -func (x *DynamicBytesFile) save(m state.Map) { + +func (x *DynamicBytesFile) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("InodeNoopRefCount", &x.InodeNoopRefCount) - m.Save("InodeNotDirectory", &x.InodeNotDirectory) - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("locks", &x.locks) - m.Save("data", &x.data) + m.Save(0, &x.InodeAttrs) + m.Save(1, &x.InodeNoopRefCount) + m.Save(2, &x.InodeNotDirectory) + m.Save(3, &x.InodeNotSymlink) + m.Save(4, &x.locks) + m.Save(5, &x.data) } func (x *DynamicBytesFile) afterLoad() {} -func (x *DynamicBytesFile) load(m state.Map) { - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("InodeNoopRefCount", &x.InodeNoopRefCount) - m.Load("InodeNotDirectory", &x.InodeNotDirectory) - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("locks", &x.locks) - m.Load("data", &x.data) + +func (x *DynamicBytesFile) StateLoad(m state.Source) { + m.Load(0, &x.InodeAttrs) + m.Load(1, &x.InodeNoopRefCount) + m.Load(2, &x.InodeNotDirectory) + m.Load(3, &x.InodeNotSymlink) + m.Load(4, &x.locks) + m.Load(5, &x.data) +} + +func (x *DynamicBytesFD) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.DynamicBytesFD" +} + +func (x *DynamicBytesFD) StateFields() []string { + return []string{ + "FileDescriptionDefaultImpl", + "DynamicBytesFileDescriptionImpl", + "LockFD", + "vfsfd", + "inode", + } } func (x *DynamicBytesFD) beforeSave() {} -func (x *DynamicBytesFD) save(m state.Map) { + +func (x *DynamicBytesFD) StateSave(m state.Sink) { x.beforeSave() - m.Save("FileDescriptionDefaultImpl", &x.FileDescriptionDefaultImpl) - m.Save("DynamicBytesFileDescriptionImpl", &x.DynamicBytesFileDescriptionImpl) - m.Save("LockFD", &x.LockFD) - m.Save("vfsfd", &x.vfsfd) - m.Save("inode", &x.inode) + m.Save(0, &x.FileDescriptionDefaultImpl) + m.Save(1, &x.DynamicBytesFileDescriptionImpl) + m.Save(2, &x.LockFD) + m.Save(3, &x.vfsfd) + m.Save(4, &x.inode) } func (x *DynamicBytesFD) afterLoad() {} -func (x *DynamicBytesFD) load(m state.Map) { - m.Load("FileDescriptionDefaultImpl", &x.FileDescriptionDefaultImpl) - m.Load("DynamicBytesFileDescriptionImpl", &x.DynamicBytesFileDescriptionImpl) - m.Load("LockFD", &x.LockFD) - m.Load("vfsfd", &x.vfsfd) - m.Load("inode", &x.inode) + +func (x *DynamicBytesFD) StateLoad(m state.Source) { + m.Load(0, &x.FileDescriptionDefaultImpl) + m.Load(1, &x.DynamicBytesFileDescriptionImpl) + m.Load(2, &x.LockFD) + m.Load(3, &x.vfsfd) + m.Load(4, &x.inode) +} + +func (x *StaticDirectory) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.StaticDirectory" +} + +func (x *StaticDirectory) StateFields() []string { + return []string{ + "InodeNotSymlink", + "InodeDirectoryNoNewChildren", + "InodeAttrs", + "InodeNoDynamicLookup", + "OrderedChildren", + "locks", + } } func (x *StaticDirectory) beforeSave() {} -func (x *StaticDirectory) save(m state.Map) { + +func (x *StaticDirectory) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("InodeNoDynamicLookup", &x.InodeNoDynamicLookup) - m.Save("OrderedChildren", &x.OrderedChildren) - m.Save("locks", &x.locks) + m.Save(0, &x.InodeNotSymlink) + m.Save(1, &x.InodeDirectoryNoNewChildren) + m.Save(2, &x.InodeAttrs) + m.Save(3, &x.InodeNoDynamicLookup) + m.Save(4, &x.OrderedChildren) + m.Save(5, &x.locks) } func (x *StaticDirectory) afterLoad() {} -func (x *StaticDirectory) load(m state.Map) { - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("InodeNoDynamicLookup", &x.InodeNoDynamicLookup) - m.Load("OrderedChildren", &x.OrderedChildren) - m.Load("locks", &x.locks) + +func (x *StaticDirectory) StateLoad(m state.Source) { + m.Load(0, &x.InodeNotSymlink) + m.Load(1, &x.InodeDirectoryNoNewChildren) + m.Load(2, &x.InodeAttrs) + m.Load(3, &x.InodeNoDynamicLookup) + m.Load(4, &x.OrderedChildren) + m.Load(5, &x.locks) +} + +func (x *slotList) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.slotList" +} + +func (x *slotList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *slotList) beforeSave() {} -func (x *slotList) save(m state.Map) { + +func (x *slotList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *slotList) afterLoad() {} -func (x *slotList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *slotList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *slotEntry) StateTypeName() string { + return "pkg/sentry/fsimpl/kernfs.slotEntry" +} + +func (x *slotEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *slotEntry) beforeSave() {} -func (x *slotEntry) save(m state.Map) { + +func (x *slotEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *slotEntry) afterLoad() {} -func (x *slotEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *slotEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) } func init() { - state.Register("pkg/sentry/fsimpl/kernfs.DynamicBytesFile", (*DynamicBytesFile)(nil), state.Fns{Save: (*DynamicBytesFile).save, Load: (*DynamicBytesFile).load}) - state.Register("pkg/sentry/fsimpl/kernfs.DynamicBytesFD", (*DynamicBytesFD)(nil), state.Fns{Save: (*DynamicBytesFD).save, Load: (*DynamicBytesFD).load}) - state.Register("pkg/sentry/fsimpl/kernfs.StaticDirectory", (*StaticDirectory)(nil), state.Fns{Save: (*StaticDirectory).save, Load: (*StaticDirectory).load}) - state.Register("pkg/sentry/fsimpl/kernfs.slotList", (*slotList)(nil), state.Fns{Save: (*slotList).save, Load: (*slotList).load}) - state.Register("pkg/sentry/fsimpl/kernfs.slotEntry", (*slotEntry)(nil), state.Fns{Save: (*slotEntry).save, Load: (*slotEntry).load}) + state.Register((*DynamicBytesFile)(nil)) + state.Register((*DynamicBytesFD)(nil)) + state.Register((*StaticDirectory)(nil)) + state.Register((*slotList)(nil)) + state.Register((*slotEntry)(nil)) } diff --git a/pkg/sentry/fsimpl/kernfs/slot_list.go b/pkg/sentry/fsimpl/kernfs/slot_list.go index 09c30bca7..c6cd74660 100644 --- a/pkg/sentry/fsimpl/kernfs/slot_list.go +++ b/pkg/sentry/fsimpl/kernfs/slot_list.go @@ -56,7 +56,7 @@ func (l *slotList) Back() *slot { // // NOTE: This is an O(n) operation. func (l *slotList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (slotElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *slotList) Remove(e *slot) { if prev != nil { slotElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { slotElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/fsimpl/proc/proc_state_autogen.go b/pkg/sentry/fsimpl/proc/proc_state_autogen.go index b940c9973..e297a6257 100644 --- a/pkg/sentry/fsimpl/proc/proc_state_autogen.go +++ b/pkg/sentry/fsimpl/proc/proc_state_autogen.go @@ -6,647 +6,1213 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *FilesystemType) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.FilesystemType" +} + +func (x *FilesystemType) StateFields() []string { + return []string{} +} + func (x *FilesystemType) beforeSave() {} -func (x *FilesystemType) save(m state.Map) { + +func (x *FilesystemType) StateSave(m state.Sink) { x.beforeSave() } func (x *FilesystemType) afterLoad() {} -func (x *FilesystemType) load(m state.Map) { + +func (x *FilesystemType) StateLoad(m state.Source) { +} + +func (x *subtasksInode) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.subtasksInode" +} + +func (x *subtasksInode) StateFields() []string { + return []string{ + "InodeNotSymlink", + "InodeDirectoryNoNewChildren", + "InodeAttrs", + "OrderedChildren", + "AlwaysValid", + "locks", + "fs", + "task", + "pidns", + "cgroupControllers", + } } func (x *subtasksInode) beforeSave() {} -func (x *subtasksInode) save(m state.Map) { + +func (x *subtasksInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("OrderedChildren", &x.OrderedChildren) - m.Save("AlwaysValid", &x.AlwaysValid) - m.Save("locks", &x.locks) - m.Save("fs", &x.fs) - m.Save("task", &x.task) - m.Save("pidns", &x.pidns) - m.Save("cgroupControllers", &x.cgroupControllers) + m.Save(0, &x.InodeNotSymlink) + m.Save(1, &x.InodeDirectoryNoNewChildren) + m.Save(2, &x.InodeAttrs) + m.Save(3, &x.OrderedChildren) + m.Save(4, &x.AlwaysValid) + m.Save(5, &x.locks) + m.Save(6, &x.fs) + m.Save(7, &x.task) + m.Save(8, &x.pidns) + m.Save(9, &x.cgroupControllers) } func (x *subtasksInode) afterLoad() {} -func (x *subtasksInode) load(m state.Map) { - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("OrderedChildren", &x.OrderedChildren) - m.Load("AlwaysValid", &x.AlwaysValid) - m.Load("locks", &x.locks) - m.Load("fs", &x.fs) - m.Load("task", &x.task) - m.Load("pidns", &x.pidns) - m.Load("cgroupControllers", &x.cgroupControllers) + +func (x *subtasksInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeNotSymlink) + m.Load(1, &x.InodeDirectoryNoNewChildren) + m.Load(2, &x.InodeAttrs) + m.Load(3, &x.OrderedChildren) + m.Load(4, &x.AlwaysValid) + m.Load(5, &x.locks) + m.Load(6, &x.fs) + m.Load(7, &x.task) + m.Load(8, &x.pidns) + m.Load(9, &x.cgroupControllers) +} + +func (x *taskInode) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.taskInode" +} + +func (x *taskInode) StateFields() []string { + return []string{ + "InodeNotSymlink", + "InodeDirectoryNoNewChildren", + "InodeNoDynamicLookup", + "InodeAttrs", + "OrderedChildren", + "locks", + "task", + } } func (x *taskInode) beforeSave() {} -func (x *taskInode) save(m state.Map) { + +func (x *taskInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Save("InodeNoDynamicLookup", &x.InodeNoDynamicLookup) - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("OrderedChildren", &x.OrderedChildren) - m.Save("locks", &x.locks) - m.Save("task", &x.task) + m.Save(0, &x.InodeNotSymlink) + m.Save(1, &x.InodeDirectoryNoNewChildren) + m.Save(2, &x.InodeNoDynamicLookup) + m.Save(3, &x.InodeAttrs) + m.Save(4, &x.OrderedChildren) + m.Save(5, &x.locks) + m.Save(6, &x.task) } func (x *taskInode) afterLoad() {} -func (x *taskInode) load(m state.Map) { - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Load("InodeNoDynamicLookup", &x.InodeNoDynamicLookup) - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("OrderedChildren", &x.OrderedChildren) - m.Load("locks", &x.locks) - m.Load("task", &x.task) + +func (x *taskInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeNotSymlink) + m.Load(1, &x.InodeDirectoryNoNewChildren) + m.Load(2, &x.InodeNoDynamicLookup) + m.Load(3, &x.InodeAttrs) + m.Load(4, &x.OrderedChildren) + m.Load(5, &x.locks) + m.Load(6, &x.task) +} + +func (x *fdDirInode) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.fdDirInode" +} + +func (x *fdDirInode) StateFields() []string { + return []string{ + "InodeNotSymlink", + "InodeDirectoryNoNewChildren", + "InodeAttrs", + "OrderedChildren", + "AlwaysValid", + "fdDir", + } } func (x *fdDirInode) beforeSave() {} -func (x *fdDirInode) save(m state.Map) { + +func (x *fdDirInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("OrderedChildren", &x.OrderedChildren) - m.Save("AlwaysValid", &x.AlwaysValid) - m.Save("fdDir", &x.fdDir) + m.Save(0, &x.InodeNotSymlink) + m.Save(1, &x.InodeDirectoryNoNewChildren) + m.Save(2, &x.InodeAttrs) + m.Save(3, &x.OrderedChildren) + m.Save(4, &x.AlwaysValid) + m.Save(5, &x.fdDir) } func (x *fdDirInode) afterLoad() {} -func (x *fdDirInode) load(m state.Map) { - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("OrderedChildren", &x.OrderedChildren) - m.Load("AlwaysValid", &x.AlwaysValid) - m.Load("fdDir", &x.fdDir) + +func (x *fdDirInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeNotSymlink) + m.Load(1, &x.InodeDirectoryNoNewChildren) + m.Load(2, &x.InodeAttrs) + m.Load(3, &x.OrderedChildren) + m.Load(4, &x.AlwaysValid) + m.Load(5, &x.fdDir) +} + +func (x *fdSymlink) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.fdSymlink" +} + +func (x *fdSymlink) StateFields() []string { + return []string{ + "InodeAttrs", + "InodeNoopRefCount", + "InodeSymlink", + "task", + "fd", + } } func (x *fdSymlink) beforeSave() {} -func (x *fdSymlink) save(m state.Map) { + +func (x *fdSymlink) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("InodeNoopRefCount", &x.InodeNoopRefCount) - m.Save("InodeSymlink", &x.InodeSymlink) - m.Save("task", &x.task) - m.Save("fd", &x.fd) + m.Save(0, &x.InodeAttrs) + m.Save(1, &x.InodeNoopRefCount) + m.Save(2, &x.InodeSymlink) + m.Save(3, &x.task) + m.Save(4, &x.fd) } func (x *fdSymlink) afterLoad() {} -func (x *fdSymlink) load(m state.Map) { - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("InodeNoopRefCount", &x.InodeNoopRefCount) - m.Load("InodeSymlink", &x.InodeSymlink) - m.Load("task", &x.task) - m.Load("fd", &x.fd) + +func (x *fdSymlink) StateLoad(m state.Source) { + m.Load(0, &x.InodeAttrs) + m.Load(1, &x.InodeNoopRefCount) + m.Load(2, &x.InodeSymlink) + m.Load(3, &x.task) + m.Load(4, &x.fd) +} + +func (x *fdInfoDirInode) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.fdInfoDirInode" +} + +func (x *fdInfoDirInode) StateFields() []string { + return []string{ + "InodeNotSymlink", + "InodeDirectoryNoNewChildren", + "InodeAttrs", + "OrderedChildren", + "AlwaysValid", + "fdDir", + } } func (x *fdInfoDirInode) beforeSave() {} -func (x *fdInfoDirInode) save(m state.Map) { + +func (x *fdInfoDirInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("OrderedChildren", &x.OrderedChildren) - m.Save("AlwaysValid", &x.AlwaysValid) - m.Save("fdDir", &x.fdDir) + m.Save(0, &x.InodeNotSymlink) + m.Save(1, &x.InodeDirectoryNoNewChildren) + m.Save(2, &x.InodeAttrs) + m.Save(3, &x.OrderedChildren) + m.Save(4, &x.AlwaysValid) + m.Save(5, &x.fdDir) } func (x *fdInfoDirInode) afterLoad() {} -func (x *fdInfoDirInode) load(m state.Map) { - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("OrderedChildren", &x.OrderedChildren) - m.Load("AlwaysValid", &x.AlwaysValid) - m.Load("fdDir", &x.fdDir) + +func (x *fdInfoDirInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeNotSymlink) + m.Load(1, &x.InodeDirectoryNoNewChildren) + m.Load(2, &x.InodeAttrs) + m.Load(3, &x.OrderedChildren) + m.Load(4, &x.AlwaysValid) + m.Load(5, &x.fdDir) +} + +func (x *fdInfoData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.fdInfoData" +} + +func (x *fdInfoData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "AtomicRefCount", + "task", + "fd", + } } func (x *fdInfoData) beforeSave() {} -func (x *fdInfoData) save(m state.Map) { + +func (x *fdInfoData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("task", &x.task) - m.Save("fd", &x.fd) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.AtomicRefCount) + m.Save(2, &x.task) + m.Save(3, &x.fd) } func (x *fdInfoData) afterLoad() {} -func (x *fdInfoData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("task", &x.task) - m.Load("fd", &x.fd) + +func (x *fdInfoData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.AtomicRefCount) + m.Load(2, &x.task) + m.Load(3, &x.fd) +} + +func (x *auxvData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.auxvData" +} + +func (x *auxvData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *auxvData) beforeSave() {} -func (x *auxvData) save(m state.Map) { + +func (x *auxvData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *auxvData) afterLoad() {} -func (x *auxvData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *auxvData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *cmdlineData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.cmdlineData" +} + +func (x *cmdlineData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + "arg", + } } func (x *cmdlineData) beforeSave() {} -func (x *cmdlineData) save(m state.Map) { + +func (x *cmdlineData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) - m.Save("arg", &x.arg) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) + m.Save(2, &x.arg) } func (x *cmdlineData) afterLoad() {} -func (x *cmdlineData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) - m.Load("arg", &x.arg) + +func (x *cmdlineData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) + m.Load(2, &x.arg) +} + +func (x *commInode) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.commInode" +} + +func (x *commInode) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *commInode) beforeSave() {} -func (x *commInode) save(m state.Map) { + +func (x *commInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *commInode) afterLoad() {} -func (x *commInode) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *commInode) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *commData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.commData" +} + +func (x *commData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *commData) beforeSave() {} -func (x *commData) save(m state.Map) { + +func (x *commData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *commData) afterLoad() {} -func (x *commData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *commData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *idMapData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.idMapData" +} + +func (x *idMapData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + "gids", + } } func (x *idMapData) beforeSave() {} -func (x *idMapData) save(m state.Map) { + +func (x *idMapData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) - m.Save("gids", &x.gids) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) + m.Save(2, &x.gids) } func (x *idMapData) afterLoad() {} -func (x *idMapData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) - m.Load("gids", &x.gids) + +func (x *idMapData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) + m.Load(2, &x.gids) +} + +func (x *mapsData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.mapsData" +} + +func (x *mapsData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *mapsData) beforeSave() {} -func (x *mapsData) save(m state.Map) { + +func (x *mapsData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *mapsData) afterLoad() {} -func (x *mapsData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *mapsData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *smapsData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.smapsData" +} + +func (x *smapsData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *smapsData) beforeSave() {} -func (x *smapsData) save(m state.Map) { + +func (x *smapsData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *smapsData) afterLoad() {} -func (x *smapsData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *smapsData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *taskStatData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.taskStatData" +} + +func (x *taskStatData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + "tgstats", + "pidns", + } } func (x *taskStatData) beforeSave() {} -func (x *taskStatData) save(m state.Map) { + +func (x *taskStatData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) - m.Save("tgstats", &x.tgstats) - m.Save("pidns", &x.pidns) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) + m.Save(2, &x.tgstats) + m.Save(3, &x.pidns) } func (x *taskStatData) afterLoad() {} -func (x *taskStatData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) - m.Load("tgstats", &x.tgstats) - m.Load("pidns", &x.pidns) + +func (x *taskStatData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) + m.Load(2, &x.tgstats) + m.Load(3, &x.pidns) +} + +func (x *statmData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.statmData" +} + +func (x *statmData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *statmData) beforeSave() {} -func (x *statmData) save(m state.Map) { + +func (x *statmData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *statmData) afterLoad() {} -func (x *statmData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *statmData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *statusData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.statusData" +} + +func (x *statusData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + "pidns", + } } func (x *statusData) beforeSave() {} -func (x *statusData) save(m state.Map) { + +func (x *statusData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) - m.Save("pidns", &x.pidns) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) + m.Save(2, &x.pidns) } func (x *statusData) afterLoad() {} -func (x *statusData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) - m.Load("pidns", &x.pidns) + +func (x *statusData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) + m.Load(2, &x.pidns) +} + +func (x *ioData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.ioData" +} + +func (x *ioData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "ioUsage", + } } func (x *ioData) beforeSave() {} -func (x *ioData) save(m state.Map) { + +func (x *ioData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("ioUsage", &x.ioUsage) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.ioUsage) } func (x *ioData) afterLoad() {} -func (x *ioData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("ioUsage", &x.ioUsage) + +func (x *ioData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.ioUsage) +} + +func (x *oomScoreAdj) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.oomScoreAdj" +} + +func (x *oomScoreAdj) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *oomScoreAdj) beforeSave() {} -func (x *oomScoreAdj) save(m state.Map) { + +func (x *oomScoreAdj) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *oomScoreAdj) afterLoad() {} -func (x *oomScoreAdj) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *oomScoreAdj) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *exeSymlink) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.exeSymlink" +} + +func (x *exeSymlink) StateFields() []string { + return []string{ + "InodeAttrs", + "InodeNoopRefCount", + "InodeSymlink", + "task", + } } func (x *exeSymlink) beforeSave() {} -func (x *exeSymlink) save(m state.Map) { + +func (x *exeSymlink) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("InodeNoopRefCount", &x.InodeNoopRefCount) - m.Save("InodeSymlink", &x.InodeSymlink) - m.Save("task", &x.task) + m.Save(0, &x.InodeAttrs) + m.Save(1, &x.InodeNoopRefCount) + m.Save(2, &x.InodeSymlink) + m.Save(3, &x.task) } func (x *exeSymlink) afterLoad() {} -func (x *exeSymlink) load(m state.Map) { - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("InodeNoopRefCount", &x.InodeNoopRefCount) - m.Load("InodeSymlink", &x.InodeSymlink) - m.Load("task", &x.task) + +func (x *exeSymlink) StateLoad(m state.Source) { + m.Load(0, &x.InodeAttrs) + m.Load(1, &x.InodeNoopRefCount) + m.Load(2, &x.InodeSymlink) + m.Load(3, &x.task) +} + +func (x *mountInfoData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.mountInfoData" +} + +func (x *mountInfoData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *mountInfoData) beforeSave() {} -func (x *mountInfoData) save(m state.Map) { + +func (x *mountInfoData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *mountInfoData) afterLoad() {} -func (x *mountInfoData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *mountInfoData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *mountsData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.mountsData" +} + +func (x *mountsData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "task", + } } func (x *mountsData) beforeSave() {} -func (x *mountsData) save(m state.Map) { + +func (x *mountsData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("task", &x.task) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.task) } func (x *mountsData) afterLoad() {} -func (x *mountsData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("task", &x.task) + +func (x *mountsData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.task) +} + +func (x *ifinet6) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.ifinet6" +} + +func (x *ifinet6) StateFields() []string { + return []string{ + "DynamicBytesFile", + "stack", + } } func (x *ifinet6) beforeSave() {} -func (x *ifinet6) save(m state.Map) { + +func (x *ifinet6) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("stack", &x.stack) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.stack) } func (x *ifinet6) afterLoad() {} -func (x *ifinet6) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("stack", &x.stack) + +func (x *ifinet6) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.stack) +} + +func (x *netDevData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.netDevData" +} + +func (x *netDevData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "stack", + } } func (x *netDevData) beforeSave() {} -func (x *netDevData) save(m state.Map) { + +func (x *netDevData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("stack", &x.stack) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.stack) } func (x *netDevData) afterLoad() {} -func (x *netDevData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("stack", &x.stack) + +func (x *netDevData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.stack) +} + +func (x *netUnixData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.netUnixData" +} + +func (x *netUnixData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "kernel", + } } func (x *netUnixData) beforeSave() {} -func (x *netUnixData) save(m state.Map) { + +func (x *netUnixData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("kernel", &x.kernel) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.kernel) } func (x *netUnixData) afterLoad() {} -func (x *netUnixData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("kernel", &x.kernel) + +func (x *netUnixData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.kernel) +} + +func (x *netTCPData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.netTCPData" +} + +func (x *netTCPData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "kernel", + } } func (x *netTCPData) beforeSave() {} -func (x *netTCPData) save(m state.Map) { + +func (x *netTCPData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("kernel", &x.kernel) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.kernel) } func (x *netTCPData) afterLoad() {} -func (x *netTCPData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("kernel", &x.kernel) + +func (x *netTCPData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.kernel) +} + +func (x *netTCP6Data) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.netTCP6Data" +} + +func (x *netTCP6Data) StateFields() []string { + return []string{ + "DynamicBytesFile", + "kernel", + } } func (x *netTCP6Data) beforeSave() {} -func (x *netTCP6Data) save(m state.Map) { + +func (x *netTCP6Data) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("kernel", &x.kernel) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.kernel) } func (x *netTCP6Data) afterLoad() {} -func (x *netTCP6Data) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("kernel", &x.kernel) + +func (x *netTCP6Data) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.kernel) +} + +func (x *netUDPData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.netUDPData" +} + +func (x *netUDPData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "kernel", + } } func (x *netUDPData) beforeSave() {} -func (x *netUDPData) save(m state.Map) { + +func (x *netUDPData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("kernel", &x.kernel) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.kernel) } func (x *netUDPData) afterLoad() {} -func (x *netUDPData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("kernel", &x.kernel) + +func (x *netUDPData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.kernel) +} + +func (x *netSnmpData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.netSnmpData" +} + +func (x *netSnmpData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "stack", + } } func (x *netSnmpData) beforeSave() {} -func (x *netSnmpData) save(m state.Map) { + +func (x *netSnmpData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("stack", &x.stack) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.stack) } func (x *netSnmpData) afterLoad() {} -func (x *netSnmpData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("stack", &x.stack) + +func (x *netSnmpData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.stack) +} + +func (x *netRouteData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.netRouteData" +} + +func (x *netRouteData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "stack", + } } func (x *netRouteData) beforeSave() {} -func (x *netRouteData) save(m state.Map) { + +func (x *netRouteData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("stack", &x.stack) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.stack) } func (x *netRouteData) afterLoad() {} -func (x *netRouteData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("stack", &x.stack) + +func (x *netRouteData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.stack) +} + +func (x *netStatData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.netStatData" +} + +func (x *netStatData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "stack", + } } func (x *netStatData) beforeSave() {} -func (x *netStatData) save(m state.Map) { + +func (x *netStatData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("stack", &x.stack) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.stack) } func (x *netStatData) afterLoad() {} -func (x *netStatData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("stack", &x.stack) + +func (x *netStatData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.stack) +} + +func (x *tasksInode) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.tasksInode" +} + +func (x *tasksInode) StateFields() []string { + return []string{ + "InodeNotSymlink", + "InodeDirectoryNoNewChildren", + "InodeAttrs", + "OrderedChildren", + "AlwaysValid", + "locks", + "fs", + "pidns", + "selfSymlink", + "threadSelfSymlink", + "cgroupControllers", + } } func (x *tasksInode) beforeSave() {} -func (x *tasksInode) save(m state.Map) { + +func (x *tasksInode) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeNotSymlink", &x.InodeNotSymlink) - m.Save("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Save("InodeAttrs", &x.InodeAttrs) - m.Save("OrderedChildren", &x.OrderedChildren) - m.Save("AlwaysValid", &x.AlwaysValid) - m.Save("locks", &x.locks) - m.Save("fs", &x.fs) - m.Save("pidns", &x.pidns) - m.Save("selfSymlink", &x.selfSymlink) - m.Save("threadSelfSymlink", &x.threadSelfSymlink) - m.Save("cgroupControllers", &x.cgroupControllers) + m.Save(0, &x.InodeNotSymlink) + m.Save(1, &x.InodeDirectoryNoNewChildren) + m.Save(2, &x.InodeAttrs) + m.Save(3, &x.OrderedChildren) + m.Save(4, &x.AlwaysValid) + m.Save(5, &x.locks) + m.Save(6, &x.fs) + m.Save(7, &x.pidns) + m.Save(8, &x.selfSymlink) + m.Save(9, &x.threadSelfSymlink) + m.Save(10, &x.cgroupControllers) } func (x *tasksInode) afterLoad() {} -func (x *tasksInode) load(m state.Map) { - m.Load("InodeNotSymlink", &x.InodeNotSymlink) - m.Load("InodeDirectoryNoNewChildren", &x.InodeDirectoryNoNewChildren) - m.Load("InodeAttrs", &x.InodeAttrs) - m.Load("OrderedChildren", &x.OrderedChildren) - m.Load("AlwaysValid", &x.AlwaysValid) - m.Load("locks", &x.locks) - m.Load("fs", &x.fs) - m.Load("pidns", &x.pidns) - m.Load("selfSymlink", &x.selfSymlink) - m.Load("threadSelfSymlink", &x.threadSelfSymlink) - m.Load("cgroupControllers", &x.cgroupControllers) + +func (x *tasksInode) StateLoad(m state.Source) { + m.Load(0, &x.InodeNotSymlink) + m.Load(1, &x.InodeDirectoryNoNewChildren) + m.Load(2, &x.InodeAttrs) + m.Load(3, &x.OrderedChildren) + m.Load(4, &x.AlwaysValid) + m.Load(5, &x.locks) + m.Load(6, &x.fs) + m.Load(7, &x.pidns) + m.Load(8, &x.selfSymlink) + m.Load(9, &x.threadSelfSymlink) + m.Load(10, &x.cgroupControllers) +} + +func (x *statData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.statData" +} + +func (x *statData) StateFields() []string { + return []string{ + "dynamicBytesFileSetAttr", + } } func (x *statData) beforeSave() {} -func (x *statData) save(m state.Map) { + +func (x *statData) StateSave(m state.Sink) { x.beforeSave() - m.Save("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + m.Save(0, &x.dynamicBytesFileSetAttr) } func (x *statData) afterLoad() {} -func (x *statData) load(m state.Map) { - m.Load("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + +func (x *statData) StateLoad(m state.Source) { + m.Load(0, &x.dynamicBytesFileSetAttr) +} + +func (x *loadavgData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.loadavgData" +} + +func (x *loadavgData) StateFields() []string { + return []string{ + "dynamicBytesFileSetAttr", + } } func (x *loadavgData) beforeSave() {} -func (x *loadavgData) save(m state.Map) { + +func (x *loadavgData) StateSave(m state.Sink) { x.beforeSave() - m.Save("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + m.Save(0, &x.dynamicBytesFileSetAttr) } func (x *loadavgData) afterLoad() {} -func (x *loadavgData) load(m state.Map) { - m.Load("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + +func (x *loadavgData) StateLoad(m state.Source) { + m.Load(0, &x.dynamicBytesFileSetAttr) +} + +func (x *meminfoData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.meminfoData" +} + +func (x *meminfoData) StateFields() []string { + return []string{ + "dynamicBytesFileSetAttr", + } } func (x *meminfoData) beforeSave() {} -func (x *meminfoData) save(m state.Map) { + +func (x *meminfoData) StateSave(m state.Sink) { x.beforeSave() - m.Save("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + m.Save(0, &x.dynamicBytesFileSetAttr) } func (x *meminfoData) afterLoad() {} -func (x *meminfoData) load(m state.Map) { - m.Load("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + +func (x *meminfoData) StateLoad(m state.Source) { + m.Load(0, &x.dynamicBytesFileSetAttr) +} + +func (x *uptimeData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.uptimeData" +} + +func (x *uptimeData) StateFields() []string { + return []string{ + "dynamicBytesFileSetAttr", + } } func (x *uptimeData) beforeSave() {} -func (x *uptimeData) save(m state.Map) { + +func (x *uptimeData) StateSave(m state.Sink) { x.beforeSave() - m.Save("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + m.Save(0, &x.dynamicBytesFileSetAttr) } func (x *uptimeData) afterLoad() {} -func (x *uptimeData) load(m state.Map) { - m.Load("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + +func (x *uptimeData) StateLoad(m state.Source) { + m.Load(0, &x.dynamicBytesFileSetAttr) +} + +func (x *versionData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.versionData" +} + +func (x *versionData) StateFields() []string { + return []string{ + "dynamicBytesFileSetAttr", + } } func (x *versionData) beforeSave() {} -func (x *versionData) save(m state.Map) { + +func (x *versionData) StateSave(m state.Sink) { x.beforeSave() - m.Save("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + m.Save(0, &x.dynamicBytesFileSetAttr) } func (x *versionData) afterLoad() {} -func (x *versionData) load(m state.Map) { - m.Load("dynamicBytesFileSetAttr", &x.dynamicBytesFileSetAttr) + +func (x *versionData) StateLoad(m state.Source) { + m.Load(0, &x.dynamicBytesFileSetAttr) +} + +func (x *filesystemsData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.filesystemsData" +} + +func (x *filesystemsData) StateFields() []string { + return []string{ + "DynamicBytesFile", + } } func (x *filesystemsData) beforeSave() {} -func (x *filesystemsData) save(m state.Map) { + +func (x *filesystemsData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) + m.Save(0, &x.DynamicBytesFile) } func (x *filesystemsData) afterLoad() {} -func (x *filesystemsData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) + +func (x *filesystemsData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) +} + +func (x *mmapMinAddrData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.mmapMinAddrData" +} + +func (x *mmapMinAddrData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "k", + } } func (x *mmapMinAddrData) beforeSave() {} -func (x *mmapMinAddrData) save(m state.Map) { + +func (x *mmapMinAddrData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("k", &x.k) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.k) } func (x *mmapMinAddrData) afterLoad() {} -func (x *mmapMinAddrData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.Load("k", &x.k) + +func (x *mmapMinAddrData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.Load(1, &x.k) +} + +func (x *hostnameData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.hostnameData" +} + +func (x *hostnameData) StateFields() []string { + return []string{ + "DynamicBytesFile", + } } func (x *hostnameData) beforeSave() {} -func (x *hostnameData) save(m state.Map) { + +func (x *hostnameData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) + m.Save(0, &x.DynamicBytesFile) } func (x *hostnameData) afterLoad() {} -func (x *hostnameData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) + +func (x *hostnameData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) +} + +func (x *tcpSackData) StateTypeName() string { + return "pkg/sentry/fsimpl/proc.tcpSackData" +} + +func (x *tcpSackData) StateFields() []string { + return []string{ + "DynamicBytesFile", + "stack", + "enabled", + } } func (x *tcpSackData) beforeSave() {} -func (x *tcpSackData) save(m state.Map) { + +func (x *tcpSackData) StateSave(m state.Sink) { x.beforeSave() - m.Save("DynamicBytesFile", &x.DynamicBytesFile) - m.Save("stack", &x.stack) - m.Save("enabled", &x.enabled) + m.Save(0, &x.DynamicBytesFile) + m.Save(1, &x.stack) + m.Save(2, &x.enabled) } func (x *tcpSackData) afterLoad() {} -func (x *tcpSackData) load(m state.Map) { - m.Load("DynamicBytesFile", &x.DynamicBytesFile) - m.LoadWait("stack", &x.stack) - m.Load("enabled", &x.enabled) + +func (x *tcpSackData) StateLoad(m state.Source) { + m.Load(0, &x.DynamicBytesFile) + m.LoadWait(1, &x.stack) + m.Load(2, &x.enabled) } func init() { - state.Register("pkg/sentry/fsimpl/proc.FilesystemType", (*FilesystemType)(nil), state.Fns{Save: (*FilesystemType).save, Load: (*FilesystemType).load}) - state.Register("pkg/sentry/fsimpl/proc.subtasksInode", (*subtasksInode)(nil), state.Fns{Save: (*subtasksInode).save, Load: (*subtasksInode).load}) - state.Register("pkg/sentry/fsimpl/proc.taskInode", (*taskInode)(nil), state.Fns{Save: (*taskInode).save, Load: (*taskInode).load}) - state.Register("pkg/sentry/fsimpl/proc.fdDirInode", (*fdDirInode)(nil), state.Fns{Save: (*fdDirInode).save, Load: (*fdDirInode).load}) - state.Register("pkg/sentry/fsimpl/proc.fdSymlink", (*fdSymlink)(nil), state.Fns{Save: (*fdSymlink).save, Load: (*fdSymlink).load}) - state.Register("pkg/sentry/fsimpl/proc.fdInfoDirInode", (*fdInfoDirInode)(nil), state.Fns{Save: (*fdInfoDirInode).save, Load: (*fdInfoDirInode).load}) - state.Register("pkg/sentry/fsimpl/proc.fdInfoData", (*fdInfoData)(nil), state.Fns{Save: (*fdInfoData).save, Load: (*fdInfoData).load}) - state.Register("pkg/sentry/fsimpl/proc.auxvData", (*auxvData)(nil), state.Fns{Save: (*auxvData).save, Load: (*auxvData).load}) - state.Register("pkg/sentry/fsimpl/proc.cmdlineData", (*cmdlineData)(nil), state.Fns{Save: (*cmdlineData).save, Load: (*cmdlineData).load}) - state.Register("pkg/sentry/fsimpl/proc.commInode", (*commInode)(nil), state.Fns{Save: (*commInode).save, Load: (*commInode).load}) - state.Register("pkg/sentry/fsimpl/proc.commData", (*commData)(nil), state.Fns{Save: (*commData).save, Load: (*commData).load}) - state.Register("pkg/sentry/fsimpl/proc.idMapData", (*idMapData)(nil), state.Fns{Save: (*idMapData).save, Load: (*idMapData).load}) - state.Register("pkg/sentry/fsimpl/proc.mapsData", (*mapsData)(nil), state.Fns{Save: (*mapsData).save, Load: (*mapsData).load}) - state.Register("pkg/sentry/fsimpl/proc.smapsData", (*smapsData)(nil), state.Fns{Save: (*smapsData).save, Load: (*smapsData).load}) - state.Register("pkg/sentry/fsimpl/proc.taskStatData", (*taskStatData)(nil), state.Fns{Save: (*taskStatData).save, Load: (*taskStatData).load}) - state.Register("pkg/sentry/fsimpl/proc.statmData", (*statmData)(nil), state.Fns{Save: (*statmData).save, Load: (*statmData).load}) - state.Register("pkg/sentry/fsimpl/proc.statusData", (*statusData)(nil), state.Fns{Save: (*statusData).save, Load: (*statusData).load}) - state.Register("pkg/sentry/fsimpl/proc.ioData", (*ioData)(nil), state.Fns{Save: (*ioData).save, Load: (*ioData).load}) - state.Register("pkg/sentry/fsimpl/proc.oomScoreAdj", (*oomScoreAdj)(nil), state.Fns{Save: (*oomScoreAdj).save, Load: (*oomScoreAdj).load}) - state.Register("pkg/sentry/fsimpl/proc.exeSymlink", (*exeSymlink)(nil), state.Fns{Save: (*exeSymlink).save, Load: (*exeSymlink).load}) - state.Register("pkg/sentry/fsimpl/proc.mountInfoData", (*mountInfoData)(nil), state.Fns{Save: (*mountInfoData).save, Load: (*mountInfoData).load}) - state.Register("pkg/sentry/fsimpl/proc.mountsData", (*mountsData)(nil), state.Fns{Save: (*mountsData).save, Load: (*mountsData).load}) - state.Register("pkg/sentry/fsimpl/proc.ifinet6", (*ifinet6)(nil), state.Fns{Save: (*ifinet6).save, Load: (*ifinet6).load}) - state.Register("pkg/sentry/fsimpl/proc.netDevData", (*netDevData)(nil), state.Fns{Save: (*netDevData).save, Load: (*netDevData).load}) - state.Register("pkg/sentry/fsimpl/proc.netUnixData", (*netUnixData)(nil), state.Fns{Save: (*netUnixData).save, Load: (*netUnixData).load}) - state.Register("pkg/sentry/fsimpl/proc.netTCPData", (*netTCPData)(nil), state.Fns{Save: (*netTCPData).save, Load: (*netTCPData).load}) - state.Register("pkg/sentry/fsimpl/proc.netTCP6Data", (*netTCP6Data)(nil), state.Fns{Save: (*netTCP6Data).save, Load: (*netTCP6Data).load}) - state.Register("pkg/sentry/fsimpl/proc.netUDPData", (*netUDPData)(nil), state.Fns{Save: (*netUDPData).save, Load: (*netUDPData).load}) - state.Register("pkg/sentry/fsimpl/proc.netSnmpData", (*netSnmpData)(nil), state.Fns{Save: (*netSnmpData).save, Load: (*netSnmpData).load}) - state.Register("pkg/sentry/fsimpl/proc.netRouteData", (*netRouteData)(nil), state.Fns{Save: (*netRouteData).save, Load: (*netRouteData).load}) - state.Register("pkg/sentry/fsimpl/proc.netStatData", (*netStatData)(nil), state.Fns{Save: (*netStatData).save, Load: (*netStatData).load}) - state.Register("pkg/sentry/fsimpl/proc.tasksInode", (*tasksInode)(nil), state.Fns{Save: (*tasksInode).save, Load: (*tasksInode).load}) - state.Register("pkg/sentry/fsimpl/proc.statData", (*statData)(nil), state.Fns{Save: (*statData).save, Load: (*statData).load}) - state.Register("pkg/sentry/fsimpl/proc.loadavgData", (*loadavgData)(nil), state.Fns{Save: (*loadavgData).save, Load: (*loadavgData).load}) - state.Register("pkg/sentry/fsimpl/proc.meminfoData", (*meminfoData)(nil), state.Fns{Save: (*meminfoData).save, Load: (*meminfoData).load}) - state.Register("pkg/sentry/fsimpl/proc.uptimeData", (*uptimeData)(nil), state.Fns{Save: (*uptimeData).save, Load: (*uptimeData).load}) - state.Register("pkg/sentry/fsimpl/proc.versionData", (*versionData)(nil), state.Fns{Save: (*versionData).save, Load: (*versionData).load}) - state.Register("pkg/sentry/fsimpl/proc.filesystemsData", (*filesystemsData)(nil), state.Fns{Save: (*filesystemsData).save, Load: (*filesystemsData).load}) - state.Register("pkg/sentry/fsimpl/proc.mmapMinAddrData", (*mmapMinAddrData)(nil), state.Fns{Save: (*mmapMinAddrData).save, Load: (*mmapMinAddrData).load}) - state.Register("pkg/sentry/fsimpl/proc.hostnameData", (*hostnameData)(nil), state.Fns{Save: (*hostnameData).save, Load: (*hostnameData).load}) - state.Register("pkg/sentry/fsimpl/proc.tcpSackData", (*tcpSackData)(nil), state.Fns{Save: (*tcpSackData).save, Load: (*tcpSackData).load}) + state.Register((*FilesystemType)(nil)) + state.Register((*subtasksInode)(nil)) + state.Register((*taskInode)(nil)) + state.Register((*fdDirInode)(nil)) + state.Register((*fdSymlink)(nil)) + state.Register((*fdInfoDirInode)(nil)) + state.Register((*fdInfoData)(nil)) + state.Register((*auxvData)(nil)) + state.Register((*cmdlineData)(nil)) + state.Register((*commInode)(nil)) + state.Register((*commData)(nil)) + state.Register((*idMapData)(nil)) + state.Register((*mapsData)(nil)) + state.Register((*smapsData)(nil)) + state.Register((*taskStatData)(nil)) + state.Register((*statmData)(nil)) + state.Register((*statusData)(nil)) + state.Register((*ioData)(nil)) + state.Register((*oomScoreAdj)(nil)) + state.Register((*exeSymlink)(nil)) + state.Register((*mountInfoData)(nil)) + state.Register((*mountsData)(nil)) + state.Register((*ifinet6)(nil)) + state.Register((*netDevData)(nil)) + state.Register((*netUnixData)(nil)) + state.Register((*netTCPData)(nil)) + state.Register((*netTCP6Data)(nil)) + state.Register((*netUDPData)(nil)) + state.Register((*netSnmpData)(nil)) + state.Register((*netRouteData)(nil)) + state.Register((*netStatData)(nil)) + state.Register((*tasksInode)(nil)) + state.Register((*statData)(nil)) + state.Register((*loadavgData)(nil)) + state.Register((*meminfoData)(nil)) + state.Register((*uptimeData)(nil)) + state.Register((*versionData)(nil)) + state.Register((*filesystemsData)(nil)) + state.Register((*mmapMinAddrData)(nil)) + state.Register((*hostnameData)(nil)) + state.Register((*tcpSackData)(nil)) } diff --git a/pkg/sentry/fsimpl/tmpfs/dentry_list.go b/pkg/sentry/fsimpl/tmpfs/dentry_list.go index 9af621dd3..95e3d13d5 100644 --- a/pkg/sentry/fsimpl/tmpfs/dentry_list.go +++ b/pkg/sentry/fsimpl/tmpfs/dentry_list.go @@ -56,7 +56,7 @@ func (l *dentryList) Back() *dentry { // // NOTE: This is an O(n) operation. func (l *dentryList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (dentryElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *dentryList) Remove(e *dentry) { if prev != nil { dentryElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { dentryElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go b/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go index 10d8b49a6..1b617bd35 100644 --- a/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go +++ b/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go @@ -6,33 +6,59 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *dentryList) StateTypeName() string { + return "pkg/sentry/fsimpl/tmpfs.dentryList" +} + +func (x *dentryList) StateFields() []string { + return []string{ + "head", + "tail", + } +} + func (x *dentryList) beforeSave() {} -func (x *dentryList) save(m state.Map) { + +func (x *dentryList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *dentryList) afterLoad() {} -func (x *dentryList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *dentryList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *dentryEntry) StateTypeName() string { + return "pkg/sentry/fsimpl/tmpfs.dentryEntry" +} + +func (x *dentryEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *dentryEntry) beforeSave() {} -func (x *dentryEntry) save(m state.Map) { + +func (x *dentryEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *dentryEntry) afterLoad() {} -func (x *dentryEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *dentryEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) } func init() { - state.Register("pkg/sentry/fsimpl/tmpfs.dentryList", (*dentryList)(nil), state.Fns{Save: (*dentryList).save, Load: (*dentryList).load}) - state.Register("pkg/sentry/fsimpl/tmpfs.dentryEntry", (*dentryEntry)(nil), state.Fns{Save: (*dentryEntry).save, Load: (*dentryEntry).load}) + state.Register((*dentryList)(nil)) + state.Register((*dentryEntry)(nil)) } diff --git a/pkg/sentry/inet/inet_state_autogen.go b/pkg/sentry/inet/inet_state_autogen.go index d2985113b..dc382a657 100644 --- a/pkg/sentry/inet/inet_state_autogen.go +++ b/pkg/sentry/inet/inet_state_autogen.go @@ -6,35 +6,61 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *TCPBufferSize) StateTypeName() string { + return "pkg/sentry/inet.TCPBufferSize" +} + +func (x *TCPBufferSize) StateFields() []string { + return []string{ + "Min", + "Default", + "Max", + } +} + func (x *TCPBufferSize) beforeSave() {} -func (x *TCPBufferSize) save(m state.Map) { + +func (x *TCPBufferSize) StateSave(m state.Sink) { x.beforeSave() - m.Save("Min", &x.Min) - m.Save("Default", &x.Default) - m.Save("Max", &x.Max) + m.Save(0, &x.Min) + m.Save(1, &x.Default) + m.Save(2, &x.Max) } func (x *TCPBufferSize) afterLoad() {} -func (x *TCPBufferSize) load(m state.Map) { - m.Load("Min", &x.Min) - m.Load("Default", &x.Default) - m.Load("Max", &x.Max) + +func (x *TCPBufferSize) StateLoad(m state.Source) { + m.Load(0, &x.Min) + m.Load(1, &x.Default) + m.Load(2, &x.Max) +} + +func (x *Namespace) StateTypeName() string { + return "pkg/sentry/inet.Namespace" +} + +func (x *Namespace) StateFields() []string { + return []string{ + "creator", + "isRoot", + } } func (x *Namespace) beforeSave() {} -func (x *Namespace) save(m state.Map) { + +func (x *Namespace) StateSave(m state.Sink) { x.beforeSave() - m.Save("creator", &x.creator) - m.Save("isRoot", &x.isRoot) + m.Save(0, &x.creator) + m.Save(1, &x.isRoot) } -func (x *Namespace) load(m state.Map) { - m.LoadWait("creator", &x.creator) - m.Load("isRoot", &x.isRoot) +func (x *Namespace) StateLoad(m state.Source) { + m.LoadWait(0, &x.creator) + m.Load(1, &x.isRoot) m.AfterLoad(x.afterLoad) } func init() { - state.Register("pkg/sentry/inet.TCPBufferSize", (*TCPBufferSize)(nil), state.Fns{Save: (*TCPBufferSize).save, Load: (*TCPBufferSize).load}) - state.Register("pkg/sentry/inet.Namespace", (*Namespace)(nil), state.Fns{Save: (*Namespace).save, Load: (*Namespace).load}) + state.Register((*TCPBufferSize)(nil)) + state.Register((*Namespace)(nil)) } diff --git a/pkg/sentry/kernel/auth/auth_state_autogen.go b/pkg/sentry/kernel/auth/auth_state_autogen.go index 36e3576e8..7a710d06d 100644 --- a/pkg/sentry/kernel/auth/auth_state_autogen.go +++ b/pkg/sentry/kernel/auth/auth_state_autogen.go @@ -6,148 +6,261 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Credentials) StateTypeName() string { + return "pkg/sentry/kernel/auth.Credentials" +} + +func (x *Credentials) StateFields() []string { + return []string{ + "RealKUID", + "EffectiveKUID", + "SavedKUID", + "RealKGID", + "EffectiveKGID", + "SavedKGID", + "ExtraKGIDs", + "PermittedCaps", + "InheritableCaps", + "EffectiveCaps", + "BoundingCaps", + "KeepCaps", + "UserNamespace", + } +} + func (x *Credentials) beforeSave() {} -func (x *Credentials) save(m state.Map) { + +func (x *Credentials) StateSave(m state.Sink) { x.beforeSave() - m.Save("RealKUID", &x.RealKUID) - m.Save("EffectiveKUID", &x.EffectiveKUID) - m.Save("SavedKUID", &x.SavedKUID) - m.Save("RealKGID", &x.RealKGID) - m.Save("EffectiveKGID", &x.EffectiveKGID) - m.Save("SavedKGID", &x.SavedKGID) - m.Save("ExtraKGIDs", &x.ExtraKGIDs) - m.Save("PermittedCaps", &x.PermittedCaps) - m.Save("InheritableCaps", &x.InheritableCaps) - m.Save("EffectiveCaps", &x.EffectiveCaps) - m.Save("BoundingCaps", &x.BoundingCaps) - m.Save("KeepCaps", &x.KeepCaps) - m.Save("UserNamespace", &x.UserNamespace) + m.Save(0, &x.RealKUID) + m.Save(1, &x.EffectiveKUID) + m.Save(2, &x.SavedKUID) + m.Save(3, &x.RealKGID) + m.Save(4, &x.EffectiveKGID) + m.Save(5, &x.SavedKGID) + m.Save(6, &x.ExtraKGIDs) + m.Save(7, &x.PermittedCaps) + m.Save(8, &x.InheritableCaps) + m.Save(9, &x.EffectiveCaps) + m.Save(10, &x.BoundingCaps) + m.Save(11, &x.KeepCaps) + m.Save(12, &x.UserNamespace) } func (x *Credentials) afterLoad() {} -func (x *Credentials) load(m state.Map) { - m.Load("RealKUID", &x.RealKUID) - m.Load("EffectiveKUID", &x.EffectiveKUID) - m.Load("SavedKUID", &x.SavedKUID) - m.Load("RealKGID", &x.RealKGID) - m.Load("EffectiveKGID", &x.EffectiveKGID) - m.Load("SavedKGID", &x.SavedKGID) - m.Load("ExtraKGIDs", &x.ExtraKGIDs) - m.Load("PermittedCaps", &x.PermittedCaps) - m.Load("InheritableCaps", &x.InheritableCaps) - m.Load("EffectiveCaps", &x.EffectiveCaps) - m.Load("BoundingCaps", &x.BoundingCaps) - m.Load("KeepCaps", &x.KeepCaps) - m.Load("UserNamespace", &x.UserNamespace) + +func (x *Credentials) StateLoad(m state.Source) { + m.Load(0, &x.RealKUID) + m.Load(1, &x.EffectiveKUID) + m.Load(2, &x.SavedKUID) + m.Load(3, &x.RealKGID) + m.Load(4, &x.EffectiveKGID) + m.Load(5, &x.SavedKGID) + m.Load(6, &x.ExtraKGIDs) + m.Load(7, &x.PermittedCaps) + m.Load(8, &x.InheritableCaps) + m.Load(9, &x.EffectiveCaps) + m.Load(10, &x.BoundingCaps) + m.Load(11, &x.KeepCaps) + m.Load(12, &x.UserNamespace) +} + +func (x *IDMapEntry) StateTypeName() string { + return "pkg/sentry/kernel/auth.IDMapEntry" +} + +func (x *IDMapEntry) StateFields() []string { + return []string{ + "FirstID", + "FirstParentID", + "Length", + } } func (x *IDMapEntry) beforeSave() {} -func (x *IDMapEntry) save(m state.Map) { + +func (x *IDMapEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("FirstID", &x.FirstID) - m.Save("FirstParentID", &x.FirstParentID) - m.Save("Length", &x.Length) + m.Save(0, &x.FirstID) + m.Save(1, &x.FirstParentID) + m.Save(2, &x.Length) } func (x *IDMapEntry) afterLoad() {} -func (x *IDMapEntry) load(m state.Map) { - m.Load("FirstID", &x.FirstID) - m.Load("FirstParentID", &x.FirstParentID) - m.Load("Length", &x.Length) + +func (x *IDMapEntry) StateLoad(m state.Source) { + m.Load(0, &x.FirstID) + m.Load(1, &x.FirstParentID) + m.Load(2, &x.Length) +} + +func (x *idMapRange) StateTypeName() string { + return "pkg/sentry/kernel/auth.idMapRange" +} + +func (x *idMapRange) StateFields() []string { + return []string{ + "Start", + "End", + } } func (x *idMapRange) beforeSave() {} -func (x *idMapRange) save(m state.Map) { + +func (x *idMapRange) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) + m.Save(0, &x.Start) + m.Save(1, &x.End) } func (x *idMapRange) afterLoad() {} -func (x *idMapRange) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) + +func (x *idMapRange) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) +} + +func (x *idMapSet) StateTypeName() string { + return "pkg/sentry/kernel/auth.idMapSet" +} + +func (x *idMapSet) StateFields() []string { + return []string{ + "root", + } } func (x *idMapSet) beforeSave() {} -func (x *idMapSet) save(m state.Map) { + +func (x *idMapSet) StateSave(m state.Sink) { x.beforeSave() var root *idMapSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *idMapSet) afterLoad() {} -func (x *idMapSet) load(m state.Map) { - m.LoadValue("root", new(*idMapSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*idMapSegmentDataSlices)) }) + +func (x *idMapSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*idMapSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*idMapSegmentDataSlices)) }) +} + +func (x *idMapnode) StateTypeName() string { + return "pkg/sentry/kernel/auth.idMapnode" +} + +func (x *idMapnode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *idMapnode) beforeSave() {} -func (x *idMapnode) save(m state.Map) { + +func (x *idMapnode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &x.children) } func (x *idMapnode) afterLoad() {} -func (x *idMapnode) 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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *idMapnode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *idMapSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/kernel/auth.idMapSegmentDataSlices" +} + +func (x *idMapSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *idMapSegmentDataSlices) beforeSave() {} -func (x *idMapSegmentDataSlices) save(m state.Map) { + +func (x *idMapSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *idMapSegmentDataSlices) afterLoad() {} -func (x *idMapSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *idMapSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *UserNamespace) StateTypeName() string { + return "pkg/sentry/kernel/auth.UserNamespace" +} + +func (x *UserNamespace) StateFields() []string { + return []string{ + "parent", + "owner", + "uidMapFromParent", + "uidMapToParent", + "gidMapFromParent", + "gidMapToParent", + } } func (x *UserNamespace) beforeSave() {} -func (x *UserNamespace) save(m state.Map) { + +func (x *UserNamespace) StateSave(m state.Sink) { x.beforeSave() - m.Save("parent", &x.parent) - m.Save("owner", &x.owner) - m.Save("uidMapFromParent", &x.uidMapFromParent) - m.Save("uidMapToParent", &x.uidMapToParent) - m.Save("gidMapFromParent", &x.gidMapFromParent) - m.Save("gidMapToParent", &x.gidMapToParent) + m.Save(0, &x.parent) + m.Save(1, &x.owner) + m.Save(2, &x.uidMapFromParent) + m.Save(3, &x.uidMapToParent) + m.Save(4, &x.gidMapFromParent) + m.Save(5, &x.gidMapToParent) } func (x *UserNamespace) afterLoad() {} -func (x *UserNamespace) load(m state.Map) { - m.Load("parent", &x.parent) - m.Load("owner", &x.owner) - m.Load("uidMapFromParent", &x.uidMapFromParent) - m.Load("uidMapToParent", &x.uidMapToParent) - m.Load("gidMapFromParent", &x.gidMapFromParent) - m.Load("gidMapToParent", &x.gidMapToParent) + +func (x *UserNamespace) StateLoad(m state.Source) { + m.Load(0, &x.parent) + m.Load(1, &x.owner) + m.Load(2, &x.uidMapFromParent) + m.Load(3, &x.uidMapToParent) + m.Load(4, &x.gidMapFromParent) + m.Load(5, &x.gidMapToParent) } func init() { - state.Register("pkg/sentry/kernel/auth.Credentials", (*Credentials)(nil), state.Fns{Save: (*Credentials).save, Load: (*Credentials).load}) - state.Register("pkg/sentry/kernel/auth.IDMapEntry", (*IDMapEntry)(nil), state.Fns{Save: (*IDMapEntry).save, Load: (*IDMapEntry).load}) - state.Register("pkg/sentry/kernel/auth.idMapRange", (*idMapRange)(nil), state.Fns{Save: (*idMapRange).save, Load: (*idMapRange).load}) - state.Register("pkg/sentry/kernel/auth.idMapSet", (*idMapSet)(nil), state.Fns{Save: (*idMapSet).save, Load: (*idMapSet).load}) - state.Register("pkg/sentry/kernel/auth.idMapnode", (*idMapnode)(nil), state.Fns{Save: (*idMapnode).save, Load: (*idMapnode).load}) - state.Register("pkg/sentry/kernel/auth.idMapSegmentDataSlices", (*idMapSegmentDataSlices)(nil), state.Fns{Save: (*idMapSegmentDataSlices).save, Load: (*idMapSegmentDataSlices).load}) - state.Register("pkg/sentry/kernel/auth.UserNamespace", (*UserNamespace)(nil), state.Fns{Save: (*UserNamespace).save, Load: (*UserNamespace).load}) + state.Register((*Credentials)(nil)) + state.Register((*IDMapEntry)(nil)) + state.Register((*idMapRange)(nil)) + state.Register((*idMapSet)(nil)) + state.Register((*idMapnode)(nil)) + state.Register((*idMapSegmentDataSlices)(nil)) + state.Register((*UserNamespace)(nil)) } diff --git a/pkg/sentry/kernel/auth/auth_unsafe_state_autogen.go b/pkg/sentry/kernel/auth/auth_unsafe_state_autogen.go index 6589b612c..0a3507dd5 100644 --- a/pkg/sentry/kernel/auth/auth_unsafe_state_autogen.go +++ b/pkg/sentry/kernel/auth/auth_unsafe_state_autogen.go @@ -6,18 +6,30 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *AtomicPtrCredentials) StateTypeName() string { + return "pkg/sentry/kernel/auth.AtomicPtrCredentials" +} + +func (x *AtomicPtrCredentials) StateFields() []string { + return []string{ + "ptr", + } +} + func (x *AtomicPtrCredentials) beforeSave() {} -func (x *AtomicPtrCredentials) save(m state.Map) { + +func (x *AtomicPtrCredentials) StateSave(m state.Sink) { x.beforeSave() var ptr *Credentials = x.savePtr() - m.SaveValue("ptr", ptr) + m.SaveValue(0, ptr) } func (x *AtomicPtrCredentials) afterLoad() {} -func (x *AtomicPtrCredentials) load(m state.Map) { - m.LoadValue("ptr", new(*Credentials), func(y interface{}) { x.loadPtr(y.(*Credentials)) }) + +func (x *AtomicPtrCredentials) StateLoad(m state.Source) { + m.LoadValue(0, new(*Credentials), func(y interface{}) { x.loadPtr(y.(*Credentials)) }) } func init() { - state.Register("pkg/sentry/kernel/auth.AtomicPtrCredentials", (*AtomicPtrCredentials)(nil), state.Fns{Save: (*AtomicPtrCredentials).save, Load: (*AtomicPtrCredentials).load}) + state.Register((*AtomicPtrCredentials)(nil)) } diff --git a/pkg/sentry/kernel/epoll/epoll_list.go b/pkg/sentry/kernel/epoll/epoll_list.go index a018f7b5c..56d05c770 100644 --- a/pkg/sentry/kernel/epoll/epoll_list.go +++ b/pkg/sentry/kernel/epoll/epoll_list.go @@ -56,7 +56,7 @@ func (l *pollEntryList) Back() *pollEntry { // // NOTE: This is an O(n) operation. func (l *pollEntryList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (pollEntryElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *pollEntryList) Remove(e *pollEntry) { if prev != nil { pollEntryElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { pollEntryElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/kernel/epoll/epoll_state_autogen.go b/pkg/sentry/kernel/epoll/epoll_state_autogen.go index da3150465..3b9d76751 100644 --- a/pkg/sentry/kernel/epoll/epoll_state_autogen.go +++ b/pkg/sentry/kernel/epoll/epoll_state_autogen.go @@ -6,108 +6,177 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *FileIdentifier) StateTypeName() string { + return "pkg/sentry/kernel/epoll.FileIdentifier" +} + +func (x *FileIdentifier) StateFields() []string { + return []string{ + "File", + "Fd", + } +} + func (x *FileIdentifier) beforeSave() {} -func (x *FileIdentifier) save(m state.Map) { + +func (x *FileIdentifier) StateSave(m state.Sink) { x.beforeSave() - m.Save("File", &x.File) - m.Save("Fd", &x.Fd) + m.Save(0, &x.File) + m.Save(1, &x.Fd) } func (x *FileIdentifier) afterLoad() {} -func (x *FileIdentifier) load(m state.Map) { - m.LoadWait("File", &x.File) - m.Load("Fd", &x.Fd) + +func (x *FileIdentifier) StateLoad(m state.Source) { + m.LoadWait(0, &x.File) + m.Load(1, &x.Fd) +} + +func (x *pollEntry) StateTypeName() string { + return "pkg/sentry/kernel/epoll.pollEntry" +} + +func (x *pollEntry) StateFields() []string { + return []string{ + "pollEntryEntry", + "id", + "userData", + "mask", + "flags", + "epoll", + } } func (x *pollEntry) beforeSave() {} -func (x *pollEntry) save(m state.Map) { + +func (x *pollEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("pollEntryEntry", &x.pollEntryEntry) - m.Save("id", &x.id) - m.Save("userData", &x.userData) - m.Save("mask", &x.mask) - m.Save("flags", &x.flags) - m.Save("epoll", &x.epoll) -} - -func (x *pollEntry) load(m state.Map) { - m.Load("pollEntryEntry", &x.pollEntryEntry) - m.LoadWait("id", &x.id) - m.Load("userData", &x.userData) - m.Load("mask", &x.mask) - m.Load("flags", &x.flags) - m.Load("epoll", &x.epoll) + m.Save(0, &x.pollEntryEntry) + m.Save(1, &x.id) + m.Save(2, &x.userData) + m.Save(3, &x.mask) + m.Save(4, &x.flags) + m.Save(5, &x.epoll) +} + +func (x *pollEntry) StateLoad(m state.Source) { + m.Load(0, &x.pollEntryEntry) + m.LoadWait(1, &x.id) + m.Load(2, &x.userData) + m.Load(3, &x.mask) + m.Load(4, &x.flags) + m.Load(5, &x.epoll) m.AfterLoad(x.afterLoad) } +func (x *EventPoll) StateTypeName() string { + return "pkg/sentry/kernel/epoll.EventPoll" +} + +func (x *EventPoll) StateFields() []string { + return []string{ + "files", + "readyList", + "waitingList", + "disabledList", + } +} + func (x *EventPoll) beforeSave() {} -func (x *EventPoll) save(m state.Map) { + +func (x *EventPoll) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.FilePipeSeek) { - m.Failf("FilePipeSeek is %#v, expected zero", &x.FilePipeSeek) + state.Failf("FilePipeSeek is %#v, expected zero", &x.FilePipeSeek) } if !state.IsZeroValue(&x.FileNotDirReaddir) { - m.Failf("FileNotDirReaddir is %#v, expected zero", &x.FileNotDirReaddir) + state.Failf("FileNotDirReaddir is %#v, expected zero", &x.FileNotDirReaddir) } if !state.IsZeroValue(&x.FileNoFsync) { - m.Failf("FileNoFsync is %#v, expected zero", &x.FileNoFsync) + state.Failf("FileNoFsync is %#v, expected zero", &x.FileNoFsync) } if !state.IsZeroValue(&x.FileNoopFlush) { - m.Failf("FileNoopFlush is %#v, expected zero", &x.FileNoopFlush) + state.Failf("FileNoopFlush is %#v, expected zero", &x.FileNoopFlush) } if !state.IsZeroValue(&x.FileNoIoctl) { - m.Failf("FileNoIoctl is %#v, expected zero", &x.FileNoIoctl) + state.Failf("FileNoIoctl is %#v, expected zero", &x.FileNoIoctl) } if !state.IsZeroValue(&x.FileNoMMap) { - m.Failf("FileNoMMap is %#v, expected zero", &x.FileNoMMap) + state.Failf("FileNoMMap is %#v, expected zero", &x.FileNoMMap) } if !state.IsZeroValue(&x.Queue) { - m.Failf("Queue is %#v, expected zero", &x.Queue) + state.Failf("Queue is %#v, expected zero", &x.Queue) } - m.Save("files", &x.files) - m.Save("readyList", &x.readyList) - m.Save("waitingList", &x.waitingList) - m.Save("disabledList", &x.disabledList) + m.Save(0, &x.files) + m.Save(1, &x.readyList) + m.Save(2, &x.waitingList) + m.Save(3, &x.disabledList) } -func (x *EventPoll) load(m state.Map) { - m.Load("files", &x.files) - m.Load("readyList", &x.readyList) - m.Load("waitingList", &x.waitingList) - m.Load("disabledList", &x.disabledList) +func (x *EventPoll) StateLoad(m state.Source) { + m.Load(0, &x.files) + m.Load(1, &x.readyList) + m.Load(2, &x.waitingList) + m.Load(3, &x.disabledList) m.AfterLoad(x.afterLoad) } +func (x *pollEntryList) StateTypeName() string { + return "pkg/sentry/kernel/epoll.pollEntryList" +} + +func (x *pollEntryList) StateFields() []string { + return []string{ + "head", + "tail", + } +} + func (x *pollEntryList) beforeSave() {} -func (x *pollEntryList) save(m state.Map) { + +func (x *pollEntryList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *pollEntryList) afterLoad() {} -func (x *pollEntryList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *pollEntryList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *pollEntryEntry) StateTypeName() string { + return "pkg/sentry/kernel/epoll.pollEntryEntry" +} + +func (x *pollEntryEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *pollEntryEntry) beforeSave() {} -func (x *pollEntryEntry) save(m state.Map) { + +func (x *pollEntryEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *pollEntryEntry) afterLoad() {} -func (x *pollEntryEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *pollEntryEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) } func init() { - state.Register("pkg/sentry/kernel/epoll.FileIdentifier", (*FileIdentifier)(nil), state.Fns{Save: (*FileIdentifier).save, Load: (*FileIdentifier).load}) - state.Register("pkg/sentry/kernel/epoll.pollEntry", (*pollEntry)(nil), state.Fns{Save: (*pollEntry).save, Load: (*pollEntry).load}) - state.Register("pkg/sentry/kernel/epoll.EventPoll", (*EventPoll)(nil), state.Fns{Save: (*EventPoll).save, Load: (*EventPoll).load}) - state.Register("pkg/sentry/kernel/epoll.pollEntryList", (*pollEntryList)(nil), state.Fns{Save: (*pollEntryList).save, Load: (*pollEntryList).load}) - state.Register("pkg/sentry/kernel/epoll.pollEntryEntry", (*pollEntryEntry)(nil), state.Fns{Save: (*pollEntryEntry).save, Load: (*pollEntryEntry).load}) + state.Register((*FileIdentifier)(nil)) + state.Register((*pollEntry)(nil)) + state.Register((*EventPoll)(nil)) + state.Register((*pollEntryList)(nil)) + state.Register((*pollEntryEntry)(nil)) } diff --git a/pkg/sentry/kernel/eventfd/eventfd_state_autogen.go b/pkg/sentry/kernel/eventfd/eventfd_state_autogen.go index 636d80ea9..72a285daa 100644 --- a/pkg/sentry/kernel/eventfd/eventfd_state_autogen.go +++ b/pkg/sentry/kernel/eventfd/eventfd_state_autogen.go @@ -6,24 +6,38 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *EventOperations) StateTypeName() string { + return "pkg/sentry/kernel/eventfd.EventOperations" +} + +func (x *EventOperations) StateFields() []string { + return []string{ + "val", + "semMode", + "hostfd", + } +} + func (x *EventOperations) beforeSave() {} -func (x *EventOperations) save(m state.Map) { + +func (x *EventOperations) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.wq) { - m.Failf("wq is %#v, expected zero", &x.wq) + state.Failf("wq is %#v, expected zero", &x.wq) } - m.Save("val", &x.val) - m.Save("semMode", &x.semMode) - m.Save("hostfd", &x.hostfd) + m.Save(0, &x.val) + m.Save(1, &x.semMode) + m.Save(2, &x.hostfd) } func (x *EventOperations) afterLoad() {} -func (x *EventOperations) load(m state.Map) { - m.Load("val", &x.val) - m.Load("semMode", &x.semMode) - m.Load("hostfd", &x.hostfd) + +func (x *EventOperations) StateLoad(m state.Source) { + m.Load(0, &x.val) + m.Load(1, &x.semMode) + m.Load(2, &x.hostfd) } func init() { - state.Register("pkg/sentry/kernel/eventfd.EventOperations", (*EventOperations)(nil), state.Fns{Save: (*EventOperations).save, Load: (*EventOperations).load}) + state.Register((*EventOperations)(nil)) } diff --git a/pkg/sentry/kernel/fasync/fasync_state_autogen.go b/pkg/sentry/kernel/fasync/fasync_state_autogen.go index fdcd48f64..8da4a1b44 100644 --- a/pkg/sentry/kernel/fasync/fasync_state_autogen.go +++ b/pkg/sentry/kernel/fasync/fasync_state_autogen.go @@ -6,27 +6,44 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *FileAsync) StateTypeName() string { + return "pkg/sentry/kernel/fasync.FileAsync" +} + +func (x *FileAsync) StateFields() []string { + return []string{ + "e", + "requester", + "registered", + "recipientPG", + "recipientTG", + "recipientT", + } +} + func (x *FileAsync) beforeSave() {} -func (x *FileAsync) save(m state.Map) { + +func (x *FileAsync) StateSave(m state.Sink) { x.beforeSave() - m.Save("e", &x.e) - m.Save("requester", &x.requester) - m.Save("registered", &x.registered) - m.Save("recipientPG", &x.recipientPG) - m.Save("recipientTG", &x.recipientTG) - m.Save("recipientT", &x.recipientT) + m.Save(0, &x.e) + m.Save(1, &x.requester) + m.Save(2, &x.registered) + m.Save(3, &x.recipientPG) + m.Save(4, &x.recipientTG) + m.Save(5, &x.recipientT) } func (x *FileAsync) afterLoad() {} -func (x *FileAsync) load(m state.Map) { - m.Load("e", &x.e) - m.Load("requester", &x.requester) - m.Load("registered", &x.registered) - m.Load("recipientPG", &x.recipientPG) - m.Load("recipientTG", &x.recipientTG) - m.Load("recipientT", &x.recipientT) + +func (x *FileAsync) StateLoad(m state.Source) { + m.Load(0, &x.e) + m.Load(1, &x.requester) + m.Load(2, &x.registered) + m.Load(3, &x.recipientPG) + m.Load(4, &x.recipientTG) + m.Load(5, &x.recipientT) } func init() { - state.Register("pkg/sentry/kernel/fasync.FileAsync", (*FileAsync)(nil), state.Fns{Save: (*FileAsync).save, Load: (*FileAsync).load}) + state.Register((*FileAsync)(nil)) } diff --git a/pkg/sentry/kernel/futex/futex_state_autogen.go b/pkg/sentry/kernel/futex/futex_state_autogen.go index 12a0788ff..13e9a97d0 100644 --- a/pkg/sentry/kernel/futex/futex_state_autogen.go +++ b/pkg/sentry/kernel/futex/futex_state_autogen.go @@ -6,61 +6,109 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *bucket) StateTypeName() string { + return "pkg/sentry/kernel/futex.bucket" +} + +func (x *bucket) StateFields() []string { + return []string{} +} + func (x *bucket) beforeSave() {} -func (x *bucket) save(m state.Map) { + +func (x *bucket) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.waiters) { - m.Failf("waiters is %#v, expected zero", &x.waiters) + state.Failf("waiters is %#v, expected zero", &x.waiters) } } func (x *bucket) afterLoad() {} -func (x *bucket) load(m state.Map) { + +func (x *bucket) StateLoad(m state.Source) { +} + +func (x *Manager) StateTypeName() string { + return "pkg/sentry/kernel/futex.Manager" +} + +func (x *Manager) StateFields() []string { + return []string{ + "sharedBucket", + } } func (x *Manager) beforeSave() {} -func (x *Manager) save(m state.Map) { + +func (x *Manager) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.privateBuckets) { - m.Failf("privateBuckets is %#v, expected zero", &x.privateBuckets) + state.Failf("privateBuckets is %#v, expected zero", &x.privateBuckets) } - m.Save("sharedBucket", &x.sharedBucket) + m.Save(0, &x.sharedBucket) } func (x *Manager) afterLoad() {} -func (x *Manager) load(m state.Map) { - m.Load("sharedBucket", &x.sharedBucket) + +func (x *Manager) StateLoad(m state.Source) { + m.Load(0, &x.sharedBucket) +} + +func (x *waiterList) StateTypeName() string { + return "pkg/sentry/kernel/futex.waiterList" +} + +func (x *waiterList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *waiterList) beforeSave() {} -func (x *waiterList) save(m state.Map) { + +func (x *waiterList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *waiterList) afterLoad() {} -func (x *waiterList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *waiterList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *waiterEntry) StateTypeName() string { + return "pkg/sentry/kernel/futex.waiterEntry" +} + +func (x *waiterEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *waiterEntry) beforeSave() {} -func (x *waiterEntry) save(m state.Map) { + +func (x *waiterEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *waiterEntry) afterLoad() {} -func (x *waiterEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *waiterEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) } func init() { - state.Register("pkg/sentry/kernel/futex.bucket", (*bucket)(nil), state.Fns{Save: (*bucket).save, Load: (*bucket).load}) - state.Register("pkg/sentry/kernel/futex.Manager", (*Manager)(nil), state.Fns{Save: (*Manager).save, Load: (*Manager).load}) - state.Register("pkg/sentry/kernel/futex.waiterList", (*waiterList)(nil), state.Fns{Save: (*waiterList).save, Load: (*waiterList).load}) - state.Register("pkg/sentry/kernel/futex.waiterEntry", (*waiterEntry)(nil), state.Fns{Save: (*waiterEntry).save, Load: (*waiterEntry).load}) + state.Register((*bucket)(nil)) + state.Register((*Manager)(nil)) + state.Register((*waiterList)(nil)) + state.Register((*waiterEntry)(nil)) } diff --git a/pkg/sentry/kernel/futex/futex_unsafe_state_autogen.go b/pkg/sentry/kernel/futex/futex_unsafe_state_autogen.go index 7fc038fce..244cdb502 100644 --- a/pkg/sentry/kernel/futex/futex_unsafe_state_autogen.go +++ b/pkg/sentry/kernel/futex/futex_unsafe_state_autogen.go @@ -6,18 +6,30 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *AtomicPtrBucket) StateTypeName() string { + return "pkg/sentry/kernel/futex.AtomicPtrBucket" +} + +func (x *AtomicPtrBucket) StateFields() []string { + return []string{ + "ptr", + } +} + func (x *AtomicPtrBucket) beforeSave() {} -func (x *AtomicPtrBucket) save(m state.Map) { + +func (x *AtomicPtrBucket) StateSave(m state.Sink) { x.beforeSave() var ptr *bucket = x.savePtr() - m.SaveValue("ptr", ptr) + m.SaveValue(0, ptr) } func (x *AtomicPtrBucket) afterLoad() {} -func (x *AtomicPtrBucket) load(m state.Map) { - m.LoadValue("ptr", new(*bucket), func(y interface{}) { x.loadPtr(y.(*bucket)) }) + +func (x *AtomicPtrBucket) StateLoad(m state.Source) { + m.LoadValue(0, new(*bucket), func(y interface{}) { x.loadPtr(y.(*bucket)) }) } func init() { - state.Register("pkg/sentry/kernel/futex.AtomicPtrBucket", (*AtomicPtrBucket)(nil), state.Fns{Save: (*AtomicPtrBucket).save, Load: (*AtomicPtrBucket).load}) + state.Register((*AtomicPtrBucket)(nil)) } diff --git a/pkg/sentry/kernel/futex/waiter_list.go b/pkg/sentry/kernel/futex/waiter_list.go index 1b7a92b62..ab6997b26 100644 --- a/pkg/sentry/kernel/futex/waiter_list.go +++ b/pkg/sentry/kernel/futex/waiter_list.go @@ -56,7 +56,7 @@ func (l *waiterList) Back() *Waiter { // // NOTE: This is an O(n) operation. func (l *waiterList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (waiterElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *waiterList) Remove(e *Waiter) { if prev != nil { waiterElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { waiterElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/kernel/kernel.go b/pkg/sentry/kernel/kernel.go index 554a42e05..2177b785a 100644 --- a/pkg/sentry/kernel/kernel.go +++ b/pkg/sentry/kernel/kernel.go @@ -34,7 +34,6 @@ package kernel import ( "errors" "fmt" - "io" "path/filepath" "sync/atomic" "time" @@ -73,6 +72,7 @@ import ( "gvisor.dev/gvisor/pkg/sentry/uniqueid" "gvisor.dev/gvisor/pkg/sentry/vfs" "gvisor.dev/gvisor/pkg/state" + "gvisor.dev/gvisor/pkg/state/wire" "gvisor.dev/gvisor/pkg/sync" "gvisor.dev/gvisor/pkg/tcpip" ) @@ -417,7 +417,7 @@ func (k *Kernel) Init(args InitKernelArgs) error { // SaveTo saves the state of k to w. // // Preconditions: The kernel must be paused throughout the call to SaveTo. -func (k *Kernel) SaveTo(w io.Writer) error { +func (k *Kernel) SaveTo(w wire.Writer) error { saveStart := time.Now() ctx := k.SupervisorContext() @@ -473,18 +473,18 @@ func (k *Kernel) SaveTo(w io.Writer) error { // // N.B. This will also be saved along with the full kernel save below. cpuidStart := time.Now() - if err := state.Save(k.SupervisorContext(), w, k.FeatureSet(), nil); err != nil { + if _, err := state.Save(k.SupervisorContext(), w, k.FeatureSet()); err != nil { return err } log.Infof("CPUID save took [%s].", time.Since(cpuidStart)) // Save the kernel state. kernelStart := time.Now() - var stats state.Stats - if err := state.Save(k.SupervisorContext(), w, k, &stats); err != nil { + stats, err := state.Save(k.SupervisorContext(), w, k) + if err != nil { return err } - log.Infof("Kernel save stats: %s", &stats) + log.Infof("Kernel save stats: %s", stats.String()) log.Infof("Kernel save took [%s].", time.Since(kernelStart)) // Save the memory file's state. @@ -629,7 +629,7 @@ func (ts *TaskSet) unregisterEpollWaiters() { } // LoadFrom returns a new Kernel loaded from args. -func (k *Kernel) LoadFrom(r io.Reader, net inet.Stack, clocks sentrytime.Clocks) error { +func (k *Kernel) LoadFrom(r wire.Reader, net inet.Stack, clocks sentrytime.Clocks) error { loadStart := time.Now() initAppCores := k.applicationCores @@ -640,7 +640,7 @@ func (k *Kernel) LoadFrom(r io.Reader, net inet.Stack, clocks sentrytime.Clocks) // don't need to explicitly install it in the Kernel. cpuidStart := time.Now() var features cpuid.FeatureSet - if err := state.Load(k.SupervisorContext(), r, &features, nil); err != nil { + if _, err := state.Load(k.SupervisorContext(), r, &features); err != nil { return err } log.Infof("CPUID load took [%s].", time.Since(cpuidStart)) @@ -655,11 +655,11 @@ func (k *Kernel) LoadFrom(r io.Reader, net inet.Stack, clocks sentrytime.Clocks) // Load the kernel state. kernelStart := time.Now() - var stats state.Stats - if err := state.Load(k.SupervisorContext(), r, k, &stats); err != nil { + stats, err := state.Load(k.SupervisorContext(), r, k) + if err != nil { return err } - log.Infof("Kernel load stats: %s", &stats) + log.Infof("Kernel load stats: %s", stats.String()) log.Infof("Kernel load took [%s].", time.Since(kernelStart)) // rootNetworkNamespace should be populated after loading the state file. diff --git a/pkg/sentry/kernel/kernel_opts_state_autogen.go b/pkg/sentry/kernel/kernel_opts_state_autogen.go index 9ed7e27c9..a01604159 100644 --- a/pkg/sentry/kernel/kernel_opts_state_autogen.go +++ b/pkg/sentry/kernel/kernel_opts_state_autogen.go @@ -6,15 +6,25 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SpecialOpts) StateTypeName() string { + return "pkg/sentry/kernel.SpecialOpts" +} + +func (x *SpecialOpts) StateFields() []string { + return []string{} +} + func (x *SpecialOpts) beforeSave() {} -func (x *SpecialOpts) save(m state.Map) { + +func (x *SpecialOpts) StateSave(m state.Sink) { x.beforeSave() } func (x *SpecialOpts) afterLoad() {} -func (x *SpecialOpts) load(m state.Map) { + +func (x *SpecialOpts) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/kernel.SpecialOpts", (*SpecialOpts)(nil), state.Fns{Save: (*SpecialOpts).save, Load: (*SpecialOpts).load}) + state.Register((*SpecialOpts)(nil)) } diff --git a/pkg/sentry/kernel/kernel_state_autogen.go b/pkg/sentry/kernel/kernel_state_autogen.go index 0c74e8c7c..8f184e712 100644 --- a/pkg/sentry/kernel/kernel_state_autogen.go +++ b/pkg/sentry/kernel/kernel_state_autogen.go @@ -9,1229 +9,2210 @@ import ( "gvisor.dev/gvisor/pkg/tcpip" ) +func (x *abstractEndpoint) StateTypeName() string { + return "pkg/sentry/kernel.abstractEndpoint" +} + +func (x *abstractEndpoint) StateFields() []string { + return []string{ + "ep", + "wr", + "name", + "ns", + } +} + func (x *abstractEndpoint) beforeSave() {} -func (x *abstractEndpoint) save(m state.Map) { + +func (x *abstractEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("ep", &x.ep) - m.Save("wr", &x.wr) - m.Save("name", &x.name) - m.Save("ns", &x.ns) + m.Save(0, &x.ep) + m.Save(1, &x.wr) + m.Save(2, &x.name) + m.Save(3, &x.ns) } func (x *abstractEndpoint) afterLoad() {} -func (x *abstractEndpoint) load(m state.Map) { - m.Load("ep", &x.ep) - m.Load("wr", &x.wr) - m.Load("name", &x.name) - m.Load("ns", &x.ns) + +func (x *abstractEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.ep) + m.Load(1, &x.wr) + m.Load(2, &x.name) + m.Load(3, &x.ns) +} + +func (x *AbstractSocketNamespace) StateTypeName() string { + return "pkg/sentry/kernel.AbstractSocketNamespace" +} + +func (x *AbstractSocketNamespace) StateFields() []string { + return []string{ + "endpoints", + } } func (x *AbstractSocketNamespace) beforeSave() {} -func (x *AbstractSocketNamespace) save(m state.Map) { + +func (x *AbstractSocketNamespace) StateSave(m state.Sink) { x.beforeSave() - m.Save("endpoints", &x.endpoints) + m.Save(0, &x.endpoints) } func (x *AbstractSocketNamespace) afterLoad() {} -func (x *AbstractSocketNamespace) load(m state.Map) { - m.Load("endpoints", &x.endpoints) + +func (x *AbstractSocketNamespace) StateLoad(m state.Source) { + m.Load(0, &x.endpoints) +} + +func (x *FDFlags) StateTypeName() string { + return "pkg/sentry/kernel.FDFlags" +} + +func (x *FDFlags) StateFields() []string { + return []string{ + "CloseOnExec", + } } func (x *FDFlags) beforeSave() {} -func (x *FDFlags) save(m state.Map) { + +func (x *FDFlags) StateSave(m state.Sink) { x.beforeSave() - m.Save("CloseOnExec", &x.CloseOnExec) + m.Save(0, &x.CloseOnExec) } func (x *FDFlags) afterLoad() {} -func (x *FDFlags) load(m state.Map) { - m.Load("CloseOnExec", &x.CloseOnExec) + +func (x *FDFlags) StateLoad(m state.Source) { + m.Load(0, &x.CloseOnExec) +} + +func (x *descriptor) StateTypeName() string { + return "pkg/sentry/kernel.descriptor" +} + +func (x *descriptor) StateFields() []string { + return []string{ + "file", + "fileVFS2", + "flags", + } } func (x *descriptor) beforeSave() {} -func (x *descriptor) save(m state.Map) { + +func (x *descriptor) StateSave(m state.Sink) { x.beforeSave() - m.Save("file", &x.file) - m.Save("fileVFS2", &x.fileVFS2) - m.Save("flags", &x.flags) + m.Save(0, &x.file) + m.Save(1, &x.fileVFS2) + m.Save(2, &x.flags) } func (x *descriptor) afterLoad() {} -func (x *descriptor) load(m state.Map) { - m.Load("file", &x.file) - m.Load("fileVFS2", &x.fileVFS2) - m.Load("flags", &x.flags) + +func (x *descriptor) StateLoad(m state.Source) { + m.Load(0, &x.file) + m.Load(1, &x.fileVFS2) + m.Load(2, &x.flags) +} + +func (x *FDTable) StateTypeName() string { + return "pkg/sentry/kernel.FDTable" +} + +func (x *FDTable) StateFields() []string { + return []string{ + "AtomicRefCount", + "k", + "next", + "used", + "descriptorTable", + } } func (x *FDTable) beforeSave() {} -func (x *FDTable) save(m state.Map) { + +func (x *FDTable) StateSave(m state.Sink) { x.beforeSave() var descriptorTable map[int32]descriptor = x.saveDescriptorTable() - m.SaveValue("descriptorTable", descriptorTable) - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("k", &x.k) - m.Save("next", &x.next) - m.Save("used", &x.used) + m.SaveValue(4, descriptorTable) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.k) + m.Save(2, &x.next) + m.Save(3, &x.used) } func (x *FDTable) afterLoad() {} -func (x *FDTable) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("k", &x.k) - m.Load("next", &x.next) - m.Load("used", &x.used) - m.LoadValue("descriptorTable", new(map[int32]descriptor), func(y interface{}) { x.loadDescriptorTable(y.(map[int32]descriptor)) }) + +func (x *FDTable) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.k) + m.Load(2, &x.next) + m.Load(3, &x.used) + m.LoadValue(4, new(map[int32]descriptor), func(y interface{}) { x.loadDescriptorTable(y.(map[int32]descriptor)) }) +} + +func (x *FSContext) StateTypeName() string { + return "pkg/sentry/kernel.FSContext" +} + +func (x *FSContext) StateFields() []string { + return []string{ + "AtomicRefCount", + "root", + "rootVFS2", + "cwd", + "cwdVFS2", + "umask", + } } func (x *FSContext) beforeSave() {} -func (x *FSContext) save(m state.Map) { + +func (x *FSContext) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("root", &x.root) - m.Save("rootVFS2", &x.rootVFS2) - m.Save("cwd", &x.cwd) - m.Save("cwdVFS2", &x.cwdVFS2) - m.Save("umask", &x.umask) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.root) + m.Save(2, &x.rootVFS2) + m.Save(3, &x.cwd) + m.Save(4, &x.cwdVFS2) + m.Save(5, &x.umask) } func (x *FSContext) afterLoad() {} -func (x *FSContext) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("root", &x.root) - m.Load("rootVFS2", &x.rootVFS2) - m.Load("cwd", &x.cwd) - m.Load("cwdVFS2", &x.cwdVFS2) - m.Load("umask", &x.umask) + +func (x *FSContext) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.root) + m.Load(2, &x.rootVFS2) + m.Load(3, &x.cwd) + m.Load(4, &x.cwdVFS2) + m.Load(5, &x.umask) +} + +func (x *IPCNamespace) StateTypeName() string { + return "pkg/sentry/kernel.IPCNamespace" +} + +func (x *IPCNamespace) StateFields() []string { + return []string{ + "userNS", + "semaphores", + "shms", + } } func (x *IPCNamespace) beforeSave() {} -func (x *IPCNamespace) save(m state.Map) { + +func (x *IPCNamespace) StateSave(m state.Sink) { x.beforeSave() - m.Save("userNS", &x.userNS) - m.Save("semaphores", &x.semaphores) - m.Save("shms", &x.shms) + m.Save(0, &x.userNS) + m.Save(1, &x.semaphores) + m.Save(2, &x.shms) } func (x *IPCNamespace) afterLoad() {} -func (x *IPCNamespace) load(m state.Map) { - m.Load("userNS", &x.userNS) - m.Load("semaphores", &x.semaphores) - m.Load("shms", &x.shms) + +func (x *IPCNamespace) StateLoad(m state.Source) { + m.Load(0, &x.userNS) + m.Load(1, &x.semaphores) + m.Load(2, &x.shms) +} + +func (x *Kernel) StateTypeName() string { + return "pkg/sentry/kernel.Kernel" +} + +func (x *Kernel) StateFields() []string { + return []string{ + "featureSet", + "timekeeper", + "tasks", + "rootUserNamespace", + "rootNetworkNamespace", + "applicationCores", + "useHostCores", + "extraAuxv", + "vdso", + "rootUTSNamespace", + "rootIPCNamespace", + "rootAbstractSocketNamespace", + "futexes", + "globalInit", + "realtimeClock", + "monotonicClock", + "syslog", + "runningTasks", + "cpuClock", + "cpuClockTickerDisabled", + "cpuClockTickerSetting", + "uniqueID", + "nextInotifyCookie", + "netlinkPorts", + "danglingEndpoints", + "sockets", + "nextSocketEntry", + "deviceRegistry", + "DirentCacheLimiter", + "SpecialOpts", + "vfs", + "hostMount", + "pipeMount", + "shmMount", + "socketMount", + "SleepForAddressSpaceActivation", + } } func (x *Kernel) beforeSave() {} -func (x *Kernel) save(m state.Map) { + +func (x *Kernel) StateSave(m state.Sink) { x.beforeSave() var danglingEndpoints []tcpip.Endpoint = x.saveDanglingEndpoints() - m.SaveValue("danglingEndpoints", danglingEndpoints) + m.SaveValue(24, danglingEndpoints) var deviceRegistry *device.Registry = x.saveDeviceRegistry() - m.SaveValue("deviceRegistry", deviceRegistry) - m.Save("featureSet", &x.featureSet) - m.Save("timekeeper", &x.timekeeper) - m.Save("tasks", &x.tasks) - m.Save("rootUserNamespace", &x.rootUserNamespace) - m.Save("rootNetworkNamespace", &x.rootNetworkNamespace) - m.Save("applicationCores", &x.applicationCores) - m.Save("useHostCores", &x.useHostCores) - m.Save("extraAuxv", &x.extraAuxv) - m.Save("vdso", &x.vdso) - m.Save("rootUTSNamespace", &x.rootUTSNamespace) - m.Save("rootIPCNamespace", &x.rootIPCNamespace) - m.Save("rootAbstractSocketNamespace", &x.rootAbstractSocketNamespace) - m.Save("futexes", &x.futexes) - m.Save("globalInit", &x.globalInit) - m.Save("realtimeClock", &x.realtimeClock) - m.Save("monotonicClock", &x.monotonicClock) - m.Save("syslog", &x.syslog) - m.Save("runningTasks", &x.runningTasks) - m.Save("cpuClock", &x.cpuClock) - m.Save("cpuClockTickerDisabled", &x.cpuClockTickerDisabled) - m.Save("cpuClockTickerSetting", &x.cpuClockTickerSetting) - m.Save("uniqueID", &x.uniqueID) - m.Save("nextInotifyCookie", &x.nextInotifyCookie) - m.Save("netlinkPorts", &x.netlinkPorts) - m.Save("sockets", &x.sockets) - m.Save("nextSocketEntry", &x.nextSocketEntry) - m.Save("DirentCacheLimiter", &x.DirentCacheLimiter) - m.Save("SpecialOpts", &x.SpecialOpts) - m.Save("vfs", &x.vfs) - m.Save("hostMount", &x.hostMount) - m.Save("pipeMount", &x.pipeMount) - m.Save("shmMount", &x.shmMount) - m.Save("socketMount", &x.socketMount) - m.Save("SleepForAddressSpaceActivation", &x.SleepForAddressSpaceActivation) + m.SaveValue(27, deviceRegistry) + m.Save(0, &x.featureSet) + m.Save(1, &x.timekeeper) + m.Save(2, &x.tasks) + m.Save(3, &x.rootUserNamespace) + m.Save(4, &x.rootNetworkNamespace) + m.Save(5, &x.applicationCores) + m.Save(6, &x.useHostCores) + m.Save(7, &x.extraAuxv) + m.Save(8, &x.vdso) + m.Save(9, &x.rootUTSNamespace) + m.Save(10, &x.rootIPCNamespace) + m.Save(11, &x.rootAbstractSocketNamespace) + m.Save(12, &x.futexes) + m.Save(13, &x.globalInit) + m.Save(14, &x.realtimeClock) + m.Save(15, &x.monotonicClock) + m.Save(16, &x.syslog) + m.Save(17, &x.runningTasks) + m.Save(18, &x.cpuClock) + m.Save(19, &x.cpuClockTickerDisabled) + m.Save(20, &x.cpuClockTickerSetting) + m.Save(21, &x.uniqueID) + m.Save(22, &x.nextInotifyCookie) + m.Save(23, &x.netlinkPorts) + m.Save(25, &x.sockets) + m.Save(26, &x.nextSocketEntry) + m.Save(28, &x.DirentCacheLimiter) + m.Save(29, &x.SpecialOpts) + m.Save(30, &x.vfs) + m.Save(31, &x.hostMount) + m.Save(32, &x.pipeMount) + m.Save(33, &x.shmMount) + m.Save(34, &x.socketMount) + m.Save(35, &x.SleepForAddressSpaceActivation) } func (x *Kernel) afterLoad() {} -func (x *Kernel) load(m state.Map) { - m.Load("featureSet", &x.featureSet) - m.Load("timekeeper", &x.timekeeper) - m.Load("tasks", &x.tasks) - m.Load("rootUserNamespace", &x.rootUserNamespace) - m.Load("rootNetworkNamespace", &x.rootNetworkNamespace) - m.Load("applicationCores", &x.applicationCores) - m.Load("useHostCores", &x.useHostCores) - m.Load("extraAuxv", &x.extraAuxv) - m.Load("vdso", &x.vdso) - m.Load("rootUTSNamespace", &x.rootUTSNamespace) - m.Load("rootIPCNamespace", &x.rootIPCNamespace) - m.Load("rootAbstractSocketNamespace", &x.rootAbstractSocketNamespace) - m.Load("futexes", &x.futexes) - m.Load("globalInit", &x.globalInit) - m.Load("realtimeClock", &x.realtimeClock) - m.Load("monotonicClock", &x.monotonicClock) - m.Load("syslog", &x.syslog) - m.Load("runningTasks", &x.runningTasks) - m.Load("cpuClock", &x.cpuClock) - m.Load("cpuClockTickerDisabled", &x.cpuClockTickerDisabled) - m.Load("cpuClockTickerSetting", &x.cpuClockTickerSetting) - m.Load("uniqueID", &x.uniqueID) - m.Load("nextInotifyCookie", &x.nextInotifyCookie) - m.Load("netlinkPorts", &x.netlinkPorts) - m.Load("sockets", &x.sockets) - m.Load("nextSocketEntry", &x.nextSocketEntry) - m.Load("DirentCacheLimiter", &x.DirentCacheLimiter) - m.Load("SpecialOpts", &x.SpecialOpts) - m.Load("vfs", &x.vfs) - m.Load("hostMount", &x.hostMount) - m.Load("pipeMount", &x.pipeMount) - m.Load("shmMount", &x.shmMount) - m.Load("socketMount", &x.socketMount) - m.Load("SleepForAddressSpaceActivation", &x.SleepForAddressSpaceActivation) - 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)) }) + +func (x *Kernel) StateLoad(m state.Source) { + m.Load(0, &x.featureSet) + m.Load(1, &x.timekeeper) + m.Load(2, &x.tasks) + m.Load(3, &x.rootUserNamespace) + m.Load(4, &x.rootNetworkNamespace) + m.Load(5, &x.applicationCores) + m.Load(6, &x.useHostCores) + m.Load(7, &x.extraAuxv) + m.Load(8, &x.vdso) + m.Load(9, &x.rootUTSNamespace) + m.Load(10, &x.rootIPCNamespace) + m.Load(11, &x.rootAbstractSocketNamespace) + m.Load(12, &x.futexes) + m.Load(13, &x.globalInit) + m.Load(14, &x.realtimeClock) + m.Load(15, &x.monotonicClock) + m.Load(16, &x.syslog) + m.Load(17, &x.runningTasks) + m.Load(18, &x.cpuClock) + m.Load(19, &x.cpuClockTickerDisabled) + m.Load(20, &x.cpuClockTickerSetting) + m.Load(21, &x.uniqueID) + m.Load(22, &x.nextInotifyCookie) + m.Load(23, &x.netlinkPorts) + m.Load(25, &x.sockets) + m.Load(26, &x.nextSocketEntry) + m.Load(28, &x.DirentCacheLimiter) + m.Load(29, &x.SpecialOpts) + m.Load(30, &x.vfs) + m.Load(31, &x.hostMount) + m.Load(32, &x.pipeMount) + m.Load(33, &x.shmMount) + m.Load(34, &x.socketMount) + m.Load(35, &x.SleepForAddressSpaceActivation) + m.LoadValue(24, new([]tcpip.Endpoint), func(y interface{}) { x.loadDanglingEndpoints(y.([]tcpip.Endpoint)) }) + m.LoadValue(27, new(*device.Registry), func(y interface{}) { x.loadDeviceRegistry(y.(*device.Registry)) }) +} + +func (x *SocketEntry) StateTypeName() string { + return "pkg/sentry/kernel.SocketEntry" +} + +func (x *SocketEntry) StateFields() []string { + return []string{ + "socketEntry", + "k", + "Sock", + "SockVFS2", + "ID", + } } func (x *SocketEntry) beforeSave() {} -func (x *SocketEntry) save(m state.Map) { + +func (x *SocketEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("socketEntry", &x.socketEntry) - m.Save("k", &x.k) - m.Save("Sock", &x.Sock) - m.Save("SockVFS2", &x.SockVFS2) - m.Save("ID", &x.ID) + m.Save(0, &x.socketEntry) + m.Save(1, &x.k) + m.Save(2, &x.Sock) + m.Save(3, &x.SockVFS2) + m.Save(4, &x.ID) } func (x *SocketEntry) afterLoad() {} -func (x *SocketEntry) load(m state.Map) { - m.Load("socketEntry", &x.socketEntry) - m.Load("k", &x.k) - m.Load("Sock", &x.Sock) - m.Load("SockVFS2", &x.SockVFS2) - m.Load("ID", &x.ID) + +func (x *SocketEntry) StateLoad(m state.Source) { + m.Load(0, &x.socketEntry) + m.Load(1, &x.k) + m.Load(2, &x.Sock) + m.Load(3, &x.SockVFS2) + m.Load(4, &x.ID) +} + +func (x *pendingSignals) StateTypeName() string { + return "pkg/sentry/kernel.pendingSignals" +} + +func (x *pendingSignals) StateFields() []string { + return []string{ + "signals", + } } func (x *pendingSignals) beforeSave() {} -func (x *pendingSignals) save(m state.Map) { + +func (x *pendingSignals) StateSave(m state.Sink) { x.beforeSave() var signals []savedPendingSignal = x.saveSignals() - m.SaveValue("signals", signals) + m.SaveValue(0, signals) } func (x *pendingSignals) afterLoad() {} -func (x *pendingSignals) load(m state.Map) { - m.LoadValue("signals", new([]savedPendingSignal), func(y interface{}) { x.loadSignals(y.([]savedPendingSignal)) }) + +func (x *pendingSignals) StateLoad(m state.Source) { + m.LoadValue(0, new([]savedPendingSignal), func(y interface{}) { x.loadSignals(y.([]savedPendingSignal)) }) +} + +func (x *pendingSignalQueue) StateTypeName() string { + return "pkg/sentry/kernel.pendingSignalQueue" +} + +func (x *pendingSignalQueue) StateFields() []string { + return []string{ + "pendingSignalList", + "length", + } } func (x *pendingSignalQueue) beforeSave() {} -func (x *pendingSignalQueue) save(m state.Map) { + +func (x *pendingSignalQueue) StateSave(m state.Sink) { x.beforeSave() - m.Save("pendingSignalList", &x.pendingSignalList) - m.Save("length", &x.length) + m.Save(0, &x.pendingSignalList) + m.Save(1, &x.length) } func (x *pendingSignalQueue) afterLoad() {} -func (x *pendingSignalQueue) load(m state.Map) { - m.Load("pendingSignalList", &x.pendingSignalList) - m.Load("length", &x.length) + +func (x *pendingSignalQueue) StateLoad(m state.Source) { + m.Load(0, &x.pendingSignalList) + m.Load(1, &x.length) +} + +func (x *pendingSignal) StateTypeName() string { + return "pkg/sentry/kernel.pendingSignal" +} + +func (x *pendingSignal) StateFields() []string { + return []string{ + "pendingSignalEntry", + "SignalInfo", + "timer", + } } func (x *pendingSignal) beforeSave() {} -func (x *pendingSignal) save(m state.Map) { + +func (x *pendingSignal) StateSave(m state.Sink) { x.beforeSave() - m.Save("pendingSignalEntry", &x.pendingSignalEntry) - m.Save("SignalInfo", &x.SignalInfo) - m.Save("timer", &x.timer) + m.Save(0, &x.pendingSignalEntry) + m.Save(1, &x.SignalInfo) + m.Save(2, &x.timer) } func (x *pendingSignal) afterLoad() {} -func (x *pendingSignal) load(m state.Map) { - m.Load("pendingSignalEntry", &x.pendingSignalEntry) - m.Load("SignalInfo", &x.SignalInfo) - m.Load("timer", &x.timer) + +func (x *pendingSignal) StateLoad(m state.Source) { + m.Load(0, &x.pendingSignalEntry) + m.Load(1, &x.SignalInfo) + m.Load(2, &x.timer) +} + +func (x *pendingSignalList) StateTypeName() string { + return "pkg/sentry/kernel.pendingSignalList" +} + +func (x *pendingSignalList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *pendingSignalList) beforeSave() {} -func (x *pendingSignalList) save(m state.Map) { + +func (x *pendingSignalList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *pendingSignalList) afterLoad() {} -func (x *pendingSignalList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *pendingSignalList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *pendingSignalEntry) StateTypeName() string { + return "pkg/sentry/kernel.pendingSignalEntry" +} + +func (x *pendingSignalEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *pendingSignalEntry) beforeSave() {} -func (x *pendingSignalEntry) save(m state.Map) { + +func (x *pendingSignalEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *pendingSignalEntry) afterLoad() {} -func (x *pendingSignalEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *pendingSignalEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *savedPendingSignal) StateTypeName() string { + return "pkg/sentry/kernel.savedPendingSignal" +} + +func (x *savedPendingSignal) StateFields() []string { + return []string{ + "si", + "timer", + } } func (x *savedPendingSignal) beforeSave() {} -func (x *savedPendingSignal) save(m state.Map) { + +func (x *savedPendingSignal) StateSave(m state.Sink) { x.beforeSave() - m.Save("si", &x.si) - m.Save("timer", &x.timer) + m.Save(0, &x.si) + m.Save(1, &x.timer) } func (x *savedPendingSignal) afterLoad() {} -func (x *savedPendingSignal) load(m state.Map) { - m.Load("si", &x.si) - m.Load("timer", &x.timer) + +func (x *savedPendingSignal) StateLoad(m state.Source) { + m.Load(0, &x.si) + m.Load(1, &x.timer) +} + +func (x *IntervalTimer) StateTypeName() string { + return "pkg/sentry/kernel.IntervalTimer" +} + +func (x *IntervalTimer) StateFields() []string { + return []string{ + "timer", + "target", + "signo", + "id", + "sigval", + "group", + "sigpending", + "sigorphan", + "overrunCur", + "overrunLast", + } } func (x *IntervalTimer) beforeSave() {} -func (x *IntervalTimer) save(m state.Map) { + +func (x *IntervalTimer) StateSave(m state.Sink) { x.beforeSave() - m.Save("timer", &x.timer) - m.Save("target", &x.target) - m.Save("signo", &x.signo) - m.Save("id", &x.id) - m.Save("sigval", &x.sigval) - m.Save("group", &x.group) - m.Save("sigpending", &x.sigpending) - m.Save("sigorphan", &x.sigorphan) - m.Save("overrunCur", &x.overrunCur) - m.Save("overrunLast", &x.overrunLast) + m.Save(0, &x.timer) + m.Save(1, &x.target) + m.Save(2, &x.signo) + m.Save(3, &x.id) + m.Save(4, &x.sigval) + m.Save(5, &x.group) + m.Save(6, &x.sigpending) + m.Save(7, &x.sigorphan) + m.Save(8, &x.overrunCur) + m.Save(9, &x.overrunLast) } func (x *IntervalTimer) afterLoad() {} -func (x *IntervalTimer) load(m state.Map) { - m.Load("timer", &x.timer) - m.Load("target", &x.target) - m.Load("signo", &x.signo) - m.Load("id", &x.id) - m.Load("sigval", &x.sigval) - m.Load("group", &x.group) - m.Load("sigpending", &x.sigpending) - m.Load("sigorphan", &x.sigorphan) - m.Load("overrunCur", &x.overrunCur) - m.Load("overrunLast", &x.overrunLast) + +func (x *IntervalTimer) StateLoad(m state.Source) { + m.Load(0, &x.timer) + m.Load(1, &x.target) + m.Load(2, &x.signo) + m.Load(3, &x.id) + m.Load(4, &x.sigval) + m.Load(5, &x.group) + m.Load(6, &x.sigpending) + m.Load(7, &x.sigorphan) + m.Load(8, &x.overrunCur) + m.Load(9, &x.overrunLast) +} + +func (x *processGroupList) StateTypeName() string { + return "pkg/sentry/kernel.processGroupList" +} + +func (x *processGroupList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *processGroupList) beforeSave() {} -func (x *processGroupList) save(m state.Map) { + +func (x *processGroupList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *processGroupList) afterLoad() {} -func (x *processGroupList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *processGroupList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *processGroupEntry) StateTypeName() string { + return "pkg/sentry/kernel.processGroupEntry" +} + +func (x *processGroupEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *processGroupEntry) beforeSave() {} -func (x *processGroupEntry) save(m state.Map) { + +func (x *processGroupEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *processGroupEntry) afterLoad() {} -func (x *processGroupEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *processGroupEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *ptraceOptions) StateTypeName() string { + return "pkg/sentry/kernel.ptraceOptions" +} + +func (x *ptraceOptions) StateFields() []string { + return []string{ + "ExitKill", + "SysGood", + "TraceClone", + "TraceExec", + "TraceExit", + "TraceFork", + "TraceSeccomp", + "TraceVfork", + "TraceVforkDone", + } } func (x *ptraceOptions) beforeSave() {} -func (x *ptraceOptions) save(m state.Map) { + +func (x *ptraceOptions) StateSave(m state.Sink) { x.beforeSave() - m.Save("ExitKill", &x.ExitKill) - m.Save("SysGood", &x.SysGood) - m.Save("TraceClone", &x.TraceClone) - m.Save("TraceExec", &x.TraceExec) - m.Save("TraceExit", &x.TraceExit) - m.Save("TraceFork", &x.TraceFork) - m.Save("TraceSeccomp", &x.TraceSeccomp) - m.Save("TraceVfork", &x.TraceVfork) - m.Save("TraceVforkDone", &x.TraceVforkDone) + m.Save(0, &x.ExitKill) + m.Save(1, &x.SysGood) + m.Save(2, &x.TraceClone) + m.Save(3, &x.TraceExec) + m.Save(4, &x.TraceExit) + m.Save(5, &x.TraceFork) + m.Save(6, &x.TraceSeccomp) + m.Save(7, &x.TraceVfork) + m.Save(8, &x.TraceVforkDone) } func (x *ptraceOptions) afterLoad() {} -func (x *ptraceOptions) load(m state.Map) { - m.Load("ExitKill", &x.ExitKill) - m.Load("SysGood", &x.SysGood) - m.Load("TraceClone", &x.TraceClone) - m.Load("TraceExec", &x.TraceExec) - m.Load("TraceExit", &x.TraceExit) - m.Load("TraceFork", &x.TraceFork) - m.Load("TraceSeccomp", &x.TraceSeccomp) - m.Load("TraceVfork", &x.TraceVfork) - m.Load("TraceVforkDone", &x.TraceVforkDone) + +func (x *ptraceOptions) StateLoad(m state.Source) { + m.Load(0, &x.ExitKill) + m.Load(1, &x.SysGood) + m.Load(2, &x.TraceClone) + m.Load(3, &x.TraceExec) + m.Load(4, &x.TraceExit) + m.Load(5, &x.TraceFork) + m.Load(6, &x.TraceSeccomp) + m.Load(7, &x.TraceVfork) + m.Load(8, &x.TraceVforkDone) +} + +func (x *ptraceStop) StateTypeName() string { + return "pkg/sentry/kernel.ptraceStop" +} + +func (x *ptraceStop) StateFields() []string { + return []string{ + "frozen", + "listen", + } } func (x *ptraceStop) beforeSave() {} -func (x *ptraceStop) save(m state.Map) { + +func (x *ptraceStop) StateSave(m state.Sink) { x.beforeSave() - m.Save("frozen", &x.frozen) - m.Save("listen", &x.listen) + m.Save(0, &x.frozen) + m.Save(1, &x.listen) } func (x *ptraceStop) afterLoad() {} -func (x *ptraceStop) load(m state.Map) { - m.Load("frozen", &x.frozen) - m.Load("listen", &x.listen) + +func (x *ptraceStop) StateLoad(m state.Source) { + m.Load(0, &x.frozen) + m.Load(1, &x.listen) +} + +func (x *OldRSeqCriticalRegion) StateTypeName() string { + return "pkg/sentry/kernel.OldRSeqCriticalRegion" +} + +func (x *OldRSeqCriticalRegion) StateFields() []string { + return []string{ + "CriticalSection", + "Restart", + } } func (x *OldRSeqCriticalRegion) beforeSave() {} -func (x *OldRSeqCriticalRegion) save(m state.Map) { + +func (x *OldRSeqCriticalRegion) StateSave(m state.Sink) { x.beforeSave() - m.Save("CriticalSection", &x.CriticalSection) - m.Save("Restart", &x.Restart) + m.Save(0, &x.CriticalSection) + m.Save(1, &x.Restart) } func (x *OldRSeqCriticalRegion) afterLoad() {} -func (x *OldRSeqCriticalRegion) load(m state.Map) { - m.Load("CriticalSection", &x.CriticalSection) - m.Load("Restart", &x.Restart) + +func (x *OldRSeqCriticalRegion) StateLoad(m state.Source) { + m.Load(0, &x.CriticalSection) + m.Load(1, &x.Restart) +} + +func (x *sessionList) StateTypeName() string { + return "pkg/sentry/kernel.sessionList" +} + +func (x *sessionList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *sessionList) beforeSave() {} -func (x *sessionList) save(m state.Map) { + +func (x *sessionList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *sessionList) afterLoad() {} -func (x *sessionList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *sessionList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *sessionEntry) StateTypeName() string { + return "pkg/sentry/kernel.sessionEntry" +} + +func (x *sessionEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *sessionEntry) beforeSave() {} -func (x *sessionEntry) save(m state.Map) { + +func (x *sessionEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *sessionEntry) afterLoad() {} -func (x *sessionEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *sessionEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *Session) StateTypeName() string { + return "pkg/sentry/kernel.Session" +} + +func (x *Session) StateFields() []string { + return []string{ + "refs", + "leader", + "id", + "foreground", + "processGroups", + "sessionEntry", + } } func (x *Session) beforeSave() {} -func (x *Session) save(m state.Map) { + +func (x *Session) StateSave(m state.Sink) { x.beforeSave() - m.Save("refs", &x.refs) - m.Save("leader", &x.leader) - m.Save("id", &x.id) - m.Save("foreground", &x.foreground) - m.Save("processGroups", &x.processGroups) - m.Save("sessionEntry", &x.sessionEntry) + m.Save(0, &x.refs) + m.Save(1, &x.leader) + m.Save(2, &x.id) + m.Save(3, &x.foreground) + m.Save(4, &x.processGroups) + m.Save(5, &x.sessionEntry) } func (x *Session) afterLoad() {} -func (x *Session) load(m state.Map) { - m.Load("refs", &x.refs) - m.Load("leader", &x.leader) - m.Load("id", &x.id) - m.Load("foreground", &x.foreground) - m.Load("processGroups", &x.processGroups) - m.Load("sessionEntry", &x.sessionEntry) + +func (x *Session) StateLoad(m state.Source) { + m.Load(0, &x.refs) + m.Load(1, &x.leader) + m.Load(2, &x.id) + m.Load(3, &x.foreground) + m.Load(4, &x.processGroups) + m.Load(5, &x.sessionEntry) +} + +func (x *ProcessGroup) StateTypeName() string { + return "pkg/sentry/kernel.ProcessGroup" +} + +func (x *ProcessGroup) StateFields() []string { + return []string{ + "refs", + "originator", + "id", + "session", + "ancestors", + "processGroupEntry", + } } func (x *ProcessGroup) beforeSave() {} -func (x *ProcessGroup) save(m state.Map) { + +func (x *ProcessGroup) StateSave(m state.Sink) { x.beforeSave() - m.Save("refs", &x.refs) - m.Save("originator", &x.originator) - m.Save("id", &x.id) - m.Save("session", &x.session) - m.Save("ancestors", &x.ancestors) - m.Save("processGroupEntry", &x.processGroupEntry) + m.Save(0, &x.refs) + m.Save(1, &x.originator) + m.Save(2, &x.id) + m.Save(3, &x.session) + m.Save(4, &x.ancestors) + m.Save(5, &x.processGroupEntry) } func (x *ProcessGroup) afterLoad() {} -func (x *ProcessGroup) load(m state.Map) { - m.Load("refs", &x.refs) - m.Load("originator", &x.originator) - m.Load("id", &x.id) - m.Load("session", &x.session) - m.Load("ancestors", &x.ancestors) - m.Load("processGroupEntry", &x.processGroupEntry) + +func (x *ProcessGroup) StateLoad(m state.Source) { + m.Load(0, &x.refs) + m.Load(1, &x.originator) + m.Load(2, &x.id) + m.Load(3, &x.session) + m.Load(4, &x.ancestors) + m.Load(5, &x.processGroupEntry) +} + +func (x *SignalHandlers) StateTypeName() string { + return "pkg/sentry/kernel.SignalHandlers" +} + +func (x *SignalHandlers) StateFields() []string { + return []string{ + "actions", + } } func (x *SignalHandlers) beforeSave() {} -func (x *SignalHandlers) save(m state.Map) { + +func (x *SignalHandlers) StateSave(m state.Sink) { x.beforeSave() - m.Save("actions", &x.actions) + m.Save(0, &x.actions) } func (x *SignalHandlers) afterLoad() {} -func (x *SignalHandlers) load(m state.Map) { - m.Load("actions", &x.actions) + +func (x *SignalHandlers) StateLoad(m state.Source) { + m.Load(0, &x.actions) +} + +func (x *socketList) StateTypeName() string { + return "pkg/sentry/kernel.socketList" +} + +func (x *socketList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *socketList) beforeSave() {} -func (x *socketList) save(m state.Map) { + +func (x *socketList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *socketList) afterLoad() {} -func (x *socketList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *socketList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *socketEntry) StateTypeName() string { + return "pkg/sentry/kernel.socketEntry" +} + +func (x *socketEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *socketEntry) beforeSave() {} -func (x *socketEntry) save(m state.Map) { + +func (x *socketEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *socketEntry) afterLoad() {} -func (x *socketEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *socketEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *syscallTableInfo) StateTypeName() string { + return "pkg/sentry/kernel.syscallTableInfo" +} + +func (x *syscallTableInfo) StateFields() []string { + return []string{ + "OS", + "Arch", + } } func (x *syscallTableInfo) beforeSave() {} -func (x *syscallTableInfo) save(m state.Map) { + +func (x *syscallTableInfo) StateSave(m state.Sink) { x.beforeSave() - m.Save("OS", &x.OS) - m.Save("Arch", &x.Arch) + m.Save(0, &x.OS) + m.Save(1, &x.Arch) } func (x *syscallTableInfo) afterLoad() {} -func (x *syscallTableInfo) load(m state.Map) { - m.Load("OS", &x.OS) - m.Load("Arch", &x.Arch) + +func (x *syscallTableInfo) StateLoad(m state.Source) { + m.Load(0, &x.OS) + m.Load(1, &x.Arch) +} + +func (x *syslog) StateTypeName() string { + return "pkg/sentry/kernel.syslog" +} + +func (x *syslog) StateFields() []string { + return []string{ + "msg", + } } func (x *syslog) beforeSave() {} -func (x *syslog) save(m state.Map) { + +func (x *syslog) StateSave(m state.Sink) { x.beforeSave() - m.Save("msg", &x.msg) + m.Save(0, &x.msg) } func (x *syslog) afterLoad() {} -func (x *syslog) load(m state.Map) { - m.Load("msg", &x.msg) + +func (x *syslog) StateLoad(m state.Source) { + m.Load(0, &x.msg) +} + +func (x *Task) StateTypeName() string { + return "pkg/sentry/kernel.Task" +} + +func (x *Task) StateFields() []string { + return []string{ + "taskNode", + "runState", + "haveSyscallReturn", + "gosched", + "yieldCount", + "pendingSignals", + "signalMask", + "realSignalMask", + "haveSavedSignalMask", + "savedSignalMask", + "signalStack", + "groupStopPending", + "groupStopAcknowledged", + "trapStopPending", + "trapNotifyPending", + "stop", + "exitStatus", + "syscallRestartBlock", + "k", + "containerID", + "tc", + "fsContext", + "fdTable", + "vforkParent", + "exitState", + "exitTracerNotified", + "exitTracerAcked", + "exitParentNotified", + "exitParentAcked", + "ptraceTracer", + "ptraceTracees", + "ptraceSeized", + "ptraceOpts", + "ptraceSyscallMode", + "ptraceSinglestep", + "ptraceCode", + "ptraceSiginfo", + "ptraceEventMsg", + "ioUsage", + "creds", + "utsns", + "ipcns", + "abstractSockets", + "mountNamespaceVFS2", + "parentDeathSignal", + "syscallFilters", + "cleartid", + "allowedCPUMask", + "cpu", + "niceness", + "numaPolicy", + "numaNodeMask", + "netns", + "rseqCPU", + "oldRSeqCPUAddr", + "rseqAddr", + "rseqSignature", + "startTime", + } } func (x *Task) beforeSave() {} -func (x *Task) save(m state.Map) { + +func (x *Task) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.signalQueue) { - m.Failf("signalQueue is %#v, expected zero", &x.signalQueue) + state.Failf("signalQueue is %#v, expected zero", &x.signalQueue) } var ptraceTracer *Task = x.savePtraceTracer() - m.SaveValue("ptraceTracer", ptraceTracer) + m.SaveValue(29, ptraceTracer) var syscallFilters []bpf.Program = x.saveSyscallFilters() - m.SaveValue("syscallFilters", syscallFilters) - m.Save("taskNode", &x.taskNode) - m.Save("runState", &x.runState) - m.Save("haveSyscallReturn", &x.haveSyscallReturn) - m.Save("gosched", &x.gosched) - m.Save("yieldCount", &x.yieldCount) - m.Save("pendingSignals", &x.pendingSignals) - m.Save("signalMask", &x.signalMask) - m.Save("realSignalMask", &x.realSignalMask) - m.Save("haveSavedSignalMask", &x.haveSavedSignalMask) - m.Save("savedSignalMask", &x.savedSignalMask) - m.Save("signalStack", &x.signalStack) - m.Save("groupStopPending", &x.groupStopPending) - m.Save("groupStopAcknowledged", &x.groupStopAcknowledged) - m.Save("trapStopPending", &x.trapStopPending) - m.Save("trapNotifyPending", &x.trapNotifyPending) - m.Save("stop", &x.stop) - m.Save("exitStatus", &x.exitStatus) - m.Save("syscallRestartBlock", &x.syscallRestartBlock) - m.Save("k", &x.k) - m.Save("containerID", &x.containerID) - m.Save("tc", &x.tc) - m.Save("fsContext", &x.fsContext) - m.Save("fdTable", &x.fdTable) - m.Save("vforkParent", &x.vforkParent) - m.Save("exitState", &x.exitState) - m.Save("exitTracerNotified", &x.exitTracerNotified) - m.Save("exitTracerAcked", &x.exitTracerAcked) - m.Save("exitParentNotified", &x.exitParentNotified) - m.Save("exitParentAcked", &x.exitParentAcked) - m.Save("ptraceTracees", &x.ptraceTracees) - m.Save("ptraceSeized", &x.ptraceSeized) - m.Save("ptraceOpts", &x.ptraceOpts) - m.Save("ptraceSyscallMode", &x.ptraceSyscallMode) - m.Save("ptraceSinglestep", &x.ptraceSinglestep) - m.Save("ptraceCode", &x.ptraceCode) - m.Save("ptraceSiginfo", &x.ptraceSiginfo) - m.Save("ptraceEventMsg", &x.ptraceEventMsg) - m.Save("ioUsage", &x.ioUsage) - m.Save("creds", &x.creds) - m.Save("utsns", &x.utsns) - m.Save("ipcns", &x.ipcns) - m.Save("abstractSockets", &x.abstractSockets) - m.Save("mountNamespaceVFS2", &x.mountNamespaceVFS2) - m.Save("parentDeathSignal", &x.parentDeathSignal) - m.Save("cleartid", &x.cleartid) - m.Save("allowedCPUMask", &x.allowedCPUMask) - m.Save("cpu", &x.cpu) - m.Save("niceness", &x.niceness) - m.Save("numaPolicy", &x.numaPolicy) - m.Save("numaNodeMask", &x.numaNodeMask) - m.Save("netns", &x.netns) - m.Save("rseqCPU", &x.rseqCPU) - m.Save("oldRSeqCPUAddr", &x.oldRSeqCPUAddr) - m.Save("rseqAddr", &x.rseqAddr) - m.Save("rseqSignature", &x.rseqSignature) - m.Save("startTime", &x.startTime) -} - -func (x *Task) load(m state.Map) { - m.Load("taskNode", &x.taskNode) - m.Load("runState", &x.runState) - m.Load("haveSyscallReturn", &x.haveSyscallReturn) - m.Load("gosched", &x.gosched) - m.Load("yieldCount", &x.yieldCount) - m.Load("pendingSignals", &x.pendingSignals) - m.Load("signalMask", &x.signalMask) - m.Load("realSignalMask", &x.realSignalMask) - m.Load("haveSavedSignalMask", &x.haveSavedSignalMask) - m.Load("savedSignalMask", &x.savedSignalMask) - m.Load("signalStack", &x.signalStack) - m.Load("groupStopPending", &x.groupStopPending) - m.Load("groupStopAcknowledged", &x.groupStopAcknowledged) - m.Load("trapStopPending", &x.trapStopPending) - m.Load("trapNotifyPending", &x.trapNotifyPending) - m.Load("stop", &x.stop) - m.Load("exitStatus", &x.exitStatus) - m.Load("syscallRestartBlock", &x.syscallRestartBlock) - m.Load("k", &x.k) - m.Load("containerID", &x.containerID) - m.Load("tc", &x.tc) - m.Load("fsContext", &x.fsContext) - m.Load("fdTable", &x.fdTable) - m.Load("vforkParent", &x.vforkParent) - m.Load("exitState", &x.exitState) - m.Load("exitTracerNotified", &x.exitTracerNotified) - m.Load("exitTracerAcked", &x.exitTracerAcked) - m.Load("exitParentNotified", &x.exitParentNotified) - m.Load("exitParentAcked", &x.exitParentAcked) - m.Load("ptraceTracees", &x.ptraceTracees) - m.Load("ptraceSeized", &x.ptraceSeized) - m.Load("ptraceOpts", &x.ptraceOpts) - m.Load("ptraceSyscallMode", &x.ptraceSyscallMode) - m.Load("ptraceSinglestep", &x.ptraceSinglestep) - m.Load("ptraceCode", &x.ptraceCode) - m.Load("ptraceSiginfo", &x.ptraceSiginfo) - m.Load("ptraceEventMsg", &x.ptraceEventMsg) - m.Load("ioUsage", &x.ioUsage) - m.Load("creds", &x.creds) - m.Load("utsns", &x.utsns) - m.Load("ipcns", &x.ipcns) - m.Load("abstractSockets", &x.abstractSockets) - m.Load("mountNamespaceVFS2", &x.mountNamespaceVFS2) - m.Load("parentDeathSignal", &x.parentDeathSignal) - m.Load("cleartid", &x.cleartid) - m.Load("allowedCPUMask", &x.allowedCPUMask) - m.Load("cpu", &x.cpu) - m.Load("niceness", &x.niceness) - m.Load("numaPolicy", &x.numaPolicy) - m.Load("numaNodeMask", &x.numaNodeMask) - m.Load("netns", &x.netns) - m.Load("rseqCPU", &x.rseqCPU) - m.Load("oldRSeqCPUAddr", &x.oldRSeqCPUAddr) - m.Load("rseqAddr", &x.rseqAddr) - m.Load("rseqSignature", &x.rseqSignature) - m.Load("startTime", &x.startTime) - m.LoadValue("ptraceTracer", new(*Task), func(y interface{}) { x.loadPtraceTracer(y.(*Task)) }) - m.LoadValue("syscallFilters", new([]bpf.Program), func(y interface{}) { x.loadSyscallFilters(y.([]bpf.Program)) }) + m.SaveValue(45, syscallFilters) + m.Save(0, &x.taskNode) + m.Save(1, &x.runState) + m.Save(2, &x.haveSyscallReturn) + m.Save(3, &x.gosched) + m.Save(4, &x.yieldCount) + m.Save(5, &x.pendingSignals) + m.Save(6, &x.signalMask) + m.Save(7, &x.realSignalMask) + m.Save(8, &x.haveSavedSignalMask) + m.Save(9, &x.savedSignalMask) + m.Save(10, &x.signalStack) + m.Save(11, &x.groupStopPending) + m.Save(12, &x.groupStopAcknowledged) + m.Save(13, &x.trapStopPending) + m.Save(14, &x.trapNotifyPending) + m.Save(15, &x.stop) + m.Save(16, &x.exitStatus) + m.Save(17, &x.syscallRestartBlock) + m.Save(18, &x.k) + m.Save(19, &x.containerID) + m.Save(20, &x.tc) + m.Save(21, &x.fsContext) + m.Save(22, &x.fdTable) + m.Save(23, &x.vforkParent) + m.Save(24, &x.exitState) + m.Save(25, &x.exitTracerNotified) + m.Save(26, &x.exitTracerAcked) + m.Save(27, &x.exitParentNotified) + m.Save(28, &x.exitParentAcked) + m.Save(30, &x.ptraceTracees) + m.Save(31, &x.ptraceSeized) + m.Save(32, &x.ptraceOpts) + m.Save(33, &x.ptraceSyscallMode) + m.Save(34, &x.ptraceSinglestep) + m.Save(35, &x.ptraceCode) + m.Save(36, &x.ptraceSiginfo) + m.Save(37, &x.ptraceEventMsg) + m.Save(38, &x.ioUsage) + m.Save(39, &x.creds) + m.Save(40, &x.utsns) + m.Save(41, &x.ipcns) + m.Save(42, &x.abstractSockets) + m.Save(43, &x.mountNamespaceVFS2) + m.Save(44, &x.parentDeathSignal) + m.Save(46, &x.cleartid) + m.Save(47, &x.allowedCPUMask) + m.Save(48, &x.cpu) + m.Save(49, &x.niceness) + m.Save(50, &x.numaPolicy) + m.Save(51, &x.numaNodeMask) + m.Save(52, &x.netns) + m.Save(53, &x.rseqCPU) + m.Save(54, &x.oldRSeqCPUAddr) + m.Save(55, &x.rseqAddr) + m.Save(56, &x.rseqSignature) + m.Save(57, &x.startTime) +} + +func (x *Task) StateLoad(m state.Source) { + m.Load(0, &x.taskNode) + m.Load(1, &x.runState) + m.Load(2, &x.haveSyscallReturn) + m.Load(3, &x.gosched) + m.Load(4, &x.yieldCount) + m.Load(5, &x.pendingSignals) + m.Load(6, &x.signalMask) + m.Load(7, &x.realSignalMask) + m.Load(8, &x.haveSavedSignalMask) + m.Load(9, &x.savedSignalMask) + m.Load(10, &x.signalStack) + m.Load(11, &x.groupStopPending) + m.Load(12, &x.groupStopAcknowledged) + m.Load(13, &x.trapStopPending) + m.Load(14, &x.trapNotifyPending) + m.Load(15, &x.stop) + m.Load(16, &x.exitStatus) + m.Load(17, &x.syscallRestartBlock) + m.Load(18, &x.k) + m.Load(19, &x.containerID) + m.Load(20, &x.tc) + m.Load(21, &x.fsContext) + m.Load(22, &x.fdTable) + m.Load(23, &x.vforkParent) + m.Load(24, &x.exitState) + m.Load(25, &x.exitTracerNotified) + m.Load(26, &x.exitTracerAcked) + m.Load(27, &x.exitParentNotified) + m.Load(28, &x.exitParentAcked) + m.Load(30, &x.ptraceTracees) + m.Load(31, &x.ptraceSeized) + m.Load(32, &x.ptraceOpts) + m.Load(33, &x.ptraceSyscallMode) + m.Load(34, &x.ptraceSinglestep) + m.Load(35, &x.ptraceCode) + m.Load(36, &x.ptraceSiginfo) + m.Load(37, &x.ptraceEventMsg) + m.Load(38, &x.ioUsage) + m.Load(39, &x.creds) + m.Load(40, &x.utsns) + m.Load(41, &x.ipcns) + m.Load(42, &x.abstractSockets) + m.Load(43, &x.mountNamespaceVFS2) + m.Load(44, &x.parentDeathSignal) + m.Load(46, &x.cleartid) + m.Load(47, &x.allowedCPUMask) + m.Load(48, &x.cpu) + m.Load(49, &x.niceness) + m.Load(50, &x.numaPolicy) + m.Load(51, &x.numaNodeMask) + m.Load(52, &x.netns) + m.Load(53, &x.rseqCPU) + m.Load(54, &x.oldRSeqCPUAddr) + m.Load(55, &x.rseqAddr) + m.Load(56, &x.rseqSignature) + m.Load(57, &x.startTime) + m.LoadValue(29, new(*Task), func(y interface{}) { x.loadPtraceTracer(y.(*Task)) }) + m.LoadValue(45, new([]bpf.Program), func(y interface{}) { x.loadSyscallFilters(y.([]bpf.Program)) }) m.AfterLoad(x.afterLoad) } +func (x *runSyscallAfterPtraceEventClone) StateTypeName() string { + return "pkg/sentry/kernel.runSyscallAfterPtraceEventClone" +} + +func (x *runSyscallAfterPtraceEventClone) StateFields() []string { + return []string{ + "vforkChild", + "vforkChildTID", + } +} + func (x *runSyscallAfterPtraceEventClone) beforeSave() {} -func (x *runSyscallAfterPtraceEventClone) save(m state.Map) { + +func (x *runSyscallAfterPtraceEventClone) StateSave(m state.Sink) { x.beforeSave() - m.Save("vforkChild", &x.vforkChild) - m.Save("vforkChildTID", &x.vforkChildTID) + m.Save(0, &x.vforkChild) + m.Save(1, &x.vforkChildTID) } func (x *runSyscallAfterPtraceEventClone) afterLoad() {} -func (x *runSyscallAfterPtraceEventClone) load(m state.Map) { - m.Load("vforkChild", &x.vforkChild) - m.Load("vforkChildTID", &x.vforkChildTID) + +func (x *runSyscallAfterPtraceEventClone) StateLoad(m state.Source) { + m.Load(0, &x.vforkChild) + m.Load(1, &x.vforkChildTID) +} + +func (x *runSyscallAfterVforkStop) StateTypeName() string { + return "pkg/sentry/kernel.runSyscallAfterVforkStop" +} + +func (x *runSyscallAfterVforkStop) StateFields() []string { + return []string{ + "childTID", + } } func (x *runSyscallAfterVforkStop) beforeSave() {} -func (x *runSyscallAfterVforkStop) save(m state.Map) { + +func (x *runSyscallAfterVforkStop) StateSave(m state.Sink) { x.beforeSave() - m.Save("childTID", &x.childTID) + m.Save(0, &x.childTID) } func (x *runSyscallAfterVforkStop) afterLoad() {} -func (x *runSyscallAfterVforkStop) load(m state.Map) { - m.Load("childTID", &x.childTID) + +func (x *runSyscallAfterVforkStop) StateLoad(m state.Source) { + m.Load(0, &x.childTID) +} + +func (x *vforkStop) StateTypeName() string { + return "pkg/sentry/kernel.vforkStop" +} + +func (x *vforkStop) StateFields() []string { + return []string{} } func (x *vforkStop) beforeSave() {} -func (x *vforkStop) save(m state.Map) { + +func (x *vforkStop) StateSave(m state.Sink) { x.beforeSave() } func (x *vforkStop) afterLoad() {} -func (x *vforkStop) load(m state.Map) { + +func (x *vforkStop) StateLoad(m state.Source) { +} + +func (x *TaskContext) StateTypeName() string { + return "pkg/sentry/kernel.TaskContext" +} + +func (x *TaskContext) StateFields() []string { + return []string{ + "Name", + "Arch", + "MemoryManager", + "fu", + "st", + } } func (x *TaskContext) beforeSave() {} -func (x *TaskContext) save(m state.Map) { + +func (x *TaskContext) StateSave(m state.Sink) { x.beforeSave() var st syscallTableInfo = x.saveSt() - m.SaveValue("st", st) - m.Save("Name", &x.Name) - m.Save("Arch", &x.Arch) - m.Save("MemoryManager", &x.MemoryManager) - m.Save("fu", &x.fu) + m.SaveValue(4, st) + m.Save(0, &x.Name) + m.Save(1, &x.Arch) + m.Save(2, &x.MemoryManager) + m.Save(3, &x.fu) } func (x *TaskContext) afterLoad() {} -func (x *TaskContext) load(m state.Map) { - m.Load("Name", &x.Name) - m.Load("Arch", &x.Arch) - m.Load("MemoryManager", &x.MemoryManager) - m.Load("fu", &x.fu) - m.LoadValue("st", new(syscallTableInfo), func(y interface{}) { x.loadSt(y.(syscallTableInfo)) }) + +func (x *TaskContext) StateLoad(m state.Source) { + m.Load(0, &x.Name) + m.Load(1, &x.Arch) + m.Load(2, &x.MemoryManager) + m.Load(3, &x.fu) + m.LoadValue(4, new(syscallTableInfo), func(y interface{}) { x.loadSt(y.(syscallTableInfo)) }) +} + +func (x *execStop) StateTypeName() string { + return "pkg/sentry/kernel.execStop" +} + +func (x *execStop) StateFields() []string { + return []string{} } func (x *execStop) beforeSave() {} -func (x *execStop) save(m state.Map) { + +func (x *execStop) StateSave(m state.Sink) { x.beforeSave() } func (x *execStop) afterLoad() {} -func (x *execStop) load(m state.Map) { + +func (x *execStop) StateLoad(m state.Source) { +} + +func (x *runSyscallAfterExecStop) StateTypeName() string { + return "pkg/sentry/kernel.runSyscallAfterExecStop" +} + +func (x *runSyscallAfterExecStop) StateFields() []string { + return []string{ + "tc", + } } func (x *runSyscallAfterExecStop) beforeSave() {} -func (x *runSyscallAfterExecStop) save(m state.Map) { + +func (x *runSyscallAfterExecStop) StateSave(m state.Sink) { x.beforeSave() - m.Save("tc", &x.tc) + m.Save(0, &x.tc) } func (x *runSyscallAfterExecStop) afterLoad() {} -func (x *runSyscallAfterExecStop) load(m state.Map) { - m.Load("tc", &x.tc) + +func (x *runSyscallAfterExecStop) StateLoad(m state.Source) { + m.Load(0, &x.tc) +} + +func (x *ExitStatus) StateTypeName() string { + return "pkg/sentry/kernel.ExitStatus" +} + +func (x *ExitStatus) StateFields() []string { + return []string{ + "Code", + "Signo", + } } func (x *ExitStatus) beforeSave() {} -func (x *ExitStatus) save(m state.Map) { + +func (x *ExitStatus) StateSave(m state.Sink) { x.beforeSave() - m.Save("Code", &x.Code) - m.Save("Signo", &x.Signo) + m.Save(0, &x.Code) + m.Save(1, &x.Signo) } func (x *ExitStatus) afterLoad() {} -func (x *ExitStatus) load(m state.Map) { - m.Load("Code", &x.Code) - m.Load("Signo", &x.Signo) + +func (x *ExitStatus) StateLoad(m state.Source) { + m.Load(0, &x.Code) + m.Load(1, &x.Signo) +} + +func (x *runExit) StateTypeName() string { + return "pkg/sentry/kernel.runExit" +} + +func (x *runExit) StateFields() []string { + return []string{} } func (x *runExit) beforeSave() {} -func (x *runExit) save(m state.Map) { + +func (x *runExit) StateSave(m state.Sink) { x.beforeSave() } func (x *runExit) afterLoad() {} -func (x *runExit) load(m state.Map) { + +func (x *runExit) StateLoad(m state.Source) { +} + +func (x *runExitMain) StateTypeName() string { + return "pkg/sentry/kernel.runExitMain" +} + +func (x *runExitMain) StateFields() []string { + return []string{} } func (x *runExitMain) beforeSave() {} -func (x *runExitMain) save(m state.Map) { + +func (x *runExitMain) StateSave(m state.Sink) { x.beforeSave() } func (x *runExitMain) afterLoad() {} -func (x *runExitMain) load(m state.Map) { + +func (x *runExitMain) StateLoad(m state.Source) { +} + +func (x *runExitNotify) StateTypeName() string { + return "pkg/sentry/kernel.runExitNotify" +} + +func (x *runExitNotify) StateFields() []string { + return []string{} } func (x *runExitNotify) beforeSave() {} -func (x *runExitNotify) save(m state.Map) { + +func (x *runExitNotify) StateSave(m state.Sink) { x.beforeSave() } func (x *runExitNotify) afterLoad() {} -func (x *runExitNotify) load(m state.Map) { + +func (x *runExitNotify) StateLoad(m state.Source) { +} + +func (x *taskList) StateTypeName() string { + return "pkg/sentry/kernel.taskList" +} + +func (x *taskList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *taskList) beforeSave() {} -func (x *taskList) save(m state.Map) { + +func (x *taskList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *taskList) afterLoad() {} -func (x *taskList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *taskList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *taskEntry) StateTypeName() string { + return "pkg/sentry/kernel.taskEntry" +} + +func (x *taskEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *taskEntry) beforeSave() {} -func (x *taskEntry) save(m state.Map) { + +func (x *taskEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *taskEntry) afterLoad() {} -func (x *taskEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *taskEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *runApp) StateTypeName() string { + return "pkg/sentry/kernel.runApp" +} + +func (x *runApp) StateFields() []string { + return []string{} } func (x *runApp) beforeSave() {} -func (x *runApp) save(m state.Map) { + +func (x *runApp) StateSave(m state.Sink) { x.beforeSave() } func (x *runApp) afterLoad() {} -func (x *runApp) load(m state.Map) { + +func (x *runApp) StateLoad(m state.Source) { +} + +func (x *TaskGoroutineSchedInfo) StateTypeName() string { + return "pkg/sentry/kernel.TaskGoroutineSchedInfo" +} + +func (x *TaskGoroutineSchedInfo) StateFields() []string { + return []string{ + "Timestamp", + "State", + "UserTicks", + "SysTicks", + } } func (x *TaskGoroutineSchedInfo) beforeSave() {} -func (x *TaskGoroutineSchedInfo) save(m state.Map) { + +func (x *TaskGoroutineSchedInfo) StateSave(m state.Sink) { x.beforeSave() - m.Save("Timestamp", &x.Timestamp) - m.Save("State", &x.State) - m.Save("UserTicks", &x.UserTicks) - m.Save("SysTicks", &x.SysTicks) + m.Save(0, &x.Timestamp) + m.Save(1, &x.State) + m.Save(2, &x.UserTicks) + m.Save(3, &x.SysTicks) } func (x *TaskGoroutineSchedInfo) afterLoad() {} -func (x *TaskGoroutineSchedInfo) load(m state.Map) { - m.Load("Timestamp", &x.Timestamp) - m.Load("State", &x.State) - m.Load("UserTicks", &x.UserTicks) - m.Load("SysTicks", &x.SysTicks) + +func (x *TaskGoroutineSchedInfo) StateLoad(m state.Source) { + m.Load(0, &x.Timestamp) + m.Load(1, &x.State) + m.Load(2, &x.UserTicks) + m.Load(3, &x.SysTicks) +} + +func (x *taskClock) StateTypeName() string { + return "pkg/sentry/kernel.taskClock" +} + +func (x *taskClock) StateFields() []string { + return []string{ + "t", + "includeSys", + } } func (x *taskClock) beforeSave() {} -func (x *taskClock) save(m state.Map) { + +func (x *taskClock) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("includeSys", &x.includeSys) + m.Save(0, &x.t) + m.Save(1, &x.includeSys) } func (x *taskClock) afterLoad() {} -func (x *taskClock) load(m state.Map) { - m.Load("t", &x.t) - m.Load("includeSys", &x.includeSys) + +func (x *taskClock) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.includeSys) +} + +func (x *tgClock) StateTypeName() string { + return "pkg/sentry/kernel.tgClock" +} + +func (x *tgClock) StateFields() []string { + return []string{ + "tg", + "includeSys", + } } func (x *tgClock) beforeSave() {} -func (x *tgClock) save(m state.Map) { + +func (x *tgClock) StateSave(m state.Sink) { x.beforeSave() - m.Save("tg", &x.tg) - m.Save("includeSys", &x.includeSys) + m.Save(0, &x.tg) + m.Save(1, &x.includeSys) } func (x *tgClock) afterLoad() {} -func (x *tgClock) load(m state.Map) { - m.Load("tg", &x.tg) - m.Load("includeSys", &x.includeSys) + +func (x *tgClock) StateLoad(m state.Source) { + m.Load(0, &x.tg) + m.Load(1, &x.includeSys) +} + +func (x *groupStop) StateTypeName() string { + return "pkg/sentry/kernel.groupStop" +} + +func (x *groupStop) StateFields() []string { + return []string{} } func (x *groupStop) beforeSave() {} -func (x *groupStop) save(m state.Map) { + +func (x *groupStop) StateSave(m state.Sink) { x.beforeSave() } func (x *groupStop) afterLoad() {} -func (x *groupStop) load(m state.Map) { + +func (x *groupStop) StateLoad(m state.Source) { +} + +func (x *runInterrupt) StateTypeName() string { + return "pkg/sentry/kernel.runInterrupt" +} + +func (x *runInterrupt) StateFields() []string { + return []string{} } func (x *runInterrupt) beforeSave() {} -func (x *runInterrupt) save(m state.Map) { + +func (x *runInterrupt) StateSave(m state.Sink) { x.beforeSave() } func (x *runInterrupt) afterLoad() {} -func (x *runInterrupt) load(m state.Map) { + +func (x *runInterrupt) StateLoad(m state.Source) { +} + +func (x *runInterruptAfterSignalDeliveryStop) StateTypeName() string { + return "pkg/sentry/kernel.runInterruptAfterSignalDeliveryStop" +} + +func (x *runInterruptAfterSignalDeliveryStop) StateFields() []string { + return []string{} } func (x *runInterruptAfterSignalDeliveryStop) beforeSave() {} -func (x *runInterruptAfterSignalDeliveryStop) save(m state.Map) { + +func (x *runInterruptAfterSignalDeliveryStop) StateSave(m state.Sink) { x.beforeSave() } func (x *runInterruptAfterSignalDeliveryStop) afterLoad() {} -func (x *runInterruptAfterSignalDeliveryStop) load(m state.Map) { + +func (x *runInterruptAfterSignalDeliveryStop) StateLoad(m state.Source) { +} + +func (x *runSyscallAfterSyscallEnterStop) StateTypeName() string { + return "pkg/sentry/kernel.runSyscallAfterSyscallEnterStop" +} + +func (x *runSyscallAfterSyscallEnterStop) StateFields() []string { + return []string{} } func (x *runSyscallAfterSyscallEnterStop) beforeSave() {} -func (x *runSyscallAfterSyscallEnterStop) save(m state.Map) { + +func (x *runSyscallAfterSyscallEnterStop) StateSave(m state.Sink) { x.beforeSave() } func (x *runSyscallAfterSyscallEnterStop) afterLoad() {} -func (x *runSyscallAfterSyscallEnterStop) load(m state.Map) { + +func (x *runSyscallAfterSyscallEnterStop) StateLoad(m state.Source) { +} + +func (x *runSyscallAfterSysemuStop) StateTypeName() string { + return "pkg/sentry/kernel.runSyscallAfterSysemuStop" +} + +func (x *runSyscallAfterSysemuStop) StateFields() []string { + return []string{} } func (x *runSyscallAfterSysemuStop) beforeSave() {} -func (x *runSyscallAfterSysemuStop) save(m state.Map) { + +func (x *runSyscallAfterSysemuStop) StateSave(m state.Sink) { x.beforeSave() } func (x *runSyscallAfterSysemuStop) afterLoad() {} -func (x *runSyscallAfterSysemuStop) load(m state.Map) { + +func (x *runSyscallAfterSysemuStop) StateLoad(m state.Source) { +} + +func (x *runSyscallReinvoke) StateTypeName() string { + return "pkg/sentry/kernel.runSyscallReinvoke" +} + +func (x *runSyscallReinvoke) StateFields() []string { + return []string{} } func (x *runSyscallReinvoke) beforeSave() {} -func (x *runSyscallReinvoke) save(m state.Map) { + +func (x *runSyscallReinvoke) StateSave(m state.Sink) { x.beforeSave() } func (x *runSyscallReinvoke) afterLoad() {} -func (x *runSyscallReinvoke) load(m state.Map) { + +func (x *runSyscallReinvoke) StateLoad(m state.Source) { +} + +func (x *runSyscallExit) StateTypeName() string { + return "pkg/sentry/kernel.runSyscallExit" +} + +func (x *runSyscallExit) StateFields() []string { + return []string{} } func (x *runSyscallExit) beforeSave() {} -func (x *runSyscallExit) save(m state.Map) { + +func (x *runSyscallExit) StateSave(m state.Sink) { x.beforeSave() } func (x *runSyscallExit) afterLoad() {} -func (x *runSyscallExit) load(m state.Map) { + +func (x *runSyscallExit) StateLoad(m state.Source) { +} + +func (x *ThreadGroup) StateTypeName() string { + return "pkg/sentry/kernel.ThreadGroup" +} + +func (x *ThreadGroup) StateFields() []string { + return []string{ + "threadGroupNode", + "signalHandlers", + "pendingSignals", + "groupStopDequeued", + "groupStopSignal", + "groupStopPendingCount", + "groupStopComplete", + "groupStopWaitable", + "groupContNotify", + "groupContInterrupted", + "groupContWaitable", + "exiting", + "exitStatus", + "terminationSignal", + "itimerRealTimer", + "itimerVirtSetting", + "itimerProfSetting", + "rlimitCPUSoftSetting", + "cpuTimersEnabled", + "timers", + "nextTimerID", + "exitedCPUStats", + "childCPUStats", + "ioUsage", + "maxRSS", + "childMaxRSS", + "limits", + "processGroup", + "execed", + "oldRSeqCritical", + "mounts", + "tty", + "oomScoreAdj", + } } func (x *ThreadGroup) beforeSave() {} -func (x *ThreadGroup) save(m state.Map) { + +func (x *ThreadGroup) StateSave(m state.Sink) { x.beforeSave() var oldRSeqCritical *OldRSeqCriticalRegion = x.saveOldRSeqCritical() - m.SaveValue("oldRSeqCritical", oldRSeqCritical) - m.Save("threadGroupNode", &x.threadGroupNode) - m.Save("signalHandlers", &x.signalHandlers) - m.Save("pendingSignals", &x.pendingSignals) - m.Save("groupStopDequeued", &x.groupStopDequeued) - m.Save("groupStopSignal", &x.groupStopSignal) - m.Save("groupStopPendingCount", &x.groupStopPendingCount) - m.Save("groupStopComplete", &x.groupStopComplete) - m.Save("groupStopWaitable", &x.groupStopWaitable) - m.Save("groupContNotify", &x.groupContNotify) - m.Save("groupContInterrupted", &x.groupContInterrupted) - m.Save("groupContWaitable", &x.groupContWaitable) - m.Save("exiting", &x.exiting) - m.Save("exitStatus", &x.exitStatus) - m.Save("terminationSignal", &x.terminationSignal) - m.Save("itimerRealTimer", &x.itimerRealTimer) - m.Save("itimerVirtSetting", &x.itimerVirtSetting) - m.Save("itimerProfSetting", &x.itimerProfSetting) - m.Save("rlimitCPUSoftSetting", &x.rlimitCPUSoftSetting) - m.Save("cpuTimersEnabled", &x.cpuTimersEnabled) - m.Save("timers", &x.timers) - m.Save("nextTimerID", &x.nextTimerID) - m.Save("exitedCPUStats", &x.exitedCPUStats) - m.Save("childCPUStats", &x.childCPUStats) - m.Save("ioUsage", &x.ioUsage) - m.Save("maxRSS", &x.maxRSS) - m.Save("childMaxRSS", &x.childMaxRSS) - m.Save("limits", &x.limits) - m.Save("processGroup", &x.processGroup) - m.Save("execed", &x.execed) - m.Save("mounts", &x.mounts) - m.Save("tty", &x.tty) - m.Save("oomScoreAdj", &x.oomScoreAdj) + m.SaveValue(29, oldRSeqCritical) + m.Save(0, &x.threadGroupNode) + m.Save(1, &x.signalHandlers) + m.Save(2, &x.pendingSignals) + m.Save(3, &x.groupStopDequeued) + m.Save(4, &x.groupStopSignal) + m.Save(5, &x.groupStopPendingCount) + m.Save(6, &x.groupStopComplete) + m.Save(7, &x.groupStopWaitable) + m.Save(8, &x.groupContNotify) + m.Save(9, &x.groupContInterrupted) + m.Save(10, &x.groupContWaitable) + m.Save(11, &x.exiting) + m.Save(12, &x.exitStatus) + m.Save(13, &x.terminationSignal) + m.Save(14, &x.itimerRealTimer) + m.Save(15, &x.itimerVirtSetting) + m.Save(16, &x.itimerProfSetting) + m.Save(17, &x.rlimitCPUSoftSetting) + m.Save(18, &x.cpuTimersEnabled) + m.Save(19, &x.timers) + m.Save(20, &x.nextTimerID) + m.Save(21, &x.exitedCPUStats) + m.Save(22, &x.childCPUStats) + m.Save(23, &x.ioUsage) + m.Save(24, &x.maxRSS) + m.Save(25, &x.childMaxRSS) + m.Save(26, &x.limits) + m.Save(27, &x.processGroup) + m.Save(28, &x.execed) + m.Save(30, &x.mounts) + m.Save(31, &x.tty) + m.Save(32, &x.oomScoreAdj) } func (x *ThreadGroup) afterLoad() {} -func (x *ThreadGroup) load(m state.Map) { - m.Load("threadGroupNode", &x.threadGroupNode) - m.Load("signalHandlers", &x.signalHandlers) - m.Load("pendingSignals", &x.pendingSignals) - m.Load("groupStopDequeued", &x.groupStopDequeued) - m.Load("groupStopSignal", &x.groupStopSignal) - m.Load("groupStopPendingCount", &x.groupStopPendingCount) - m.Load("groupStopComplete", &x.groupStopComplete) - m.Load("groupStopWaitable", &x.groupStopWaitable) - m.Load("groupContNotify", &x.groupContNotify) - m.Load("groupContInterrupted", &x.groupContInterrupted) - m.Load("groupContWaitable", &x.groupContWaitable) - m.Load("exiting", &x.exiting) - m.Load("exitStatus", &x.exitStatus) - m.Load("terminationSignal", &x.terminationSignal) - m.Load("itimerRealTimer", &x.itimerRealTimer) - m.Load("itimerVirtSetting", &x.itimerVirtSetting) - m.Load("itimerProfSetting", &x.itimerProfSetting) - m.Load("rlimitCPUSoftSetting", &x.rlimitCPUSoftSetting) - m.Load("cpuTimersEnabled", &x.cpuTimersEnabled) - m.Load("timers", &x.timers) - m.Load("nextTimerID", &x.nextTimerID) - m.Load("exitedCPUStats", &x.exitedCPUStats) - m.Load("childCPUStats", &x.childCPUStats) - m.Load("ioUsage", &x.ioUsage) - m.Load("maxRSS", &x.maxRSS) - m.Load("childMaxRSS", &x.childMaxRSS) - m.Load("limits", &x.limits) - m.Load("processGroup", &x.processGroup) - m.Load("execed", &x.execed) - m.Load("mounts", &x.mounts) - m.Load("tty", &x.tty) - m.Load("oomScoreAdj", &x.oomScoreAdj) - m.LoadValue("oldRSeqCritical", new(*OldRSeqCriticalRegion), func(y interface{}) { x.loadOldRSeqCritical(y.(*OldRSeqCriticalRegion)) }) + +func (x *ThreadGroup) StateLoad(m state.Source) { + m.Load(0, &x.threadGroupNode) + m.Load(1, &x.signalHandlers) + m.Load(2, &x.pendingSignals) + m.Load(3, &x.groupStopDequeued) + m.Load(4, &x.groupStopSignal) + m.Load(5, &x.groupStopPendingCount) + m.Load(6, &x.groupStopComplete) + m.Load(7, &x.groupStopWaitable) + m.Load(8, &x.groupContNotify) + m.Load(9, &x.groupContInterrupted) + m.Load(10, &x.groupContWaitable) + m.Load(11, &x.exiting) + m.Load(12, &x.exitStatus) + m.Load(13, &x.terminationSignal) + m.Load(14, &x.itimerRealTimer) + m.Load(15, &x.itimerVirtSetting) + m.Load(16, &x.itimerProfSetting) + m.Load(17, &x.rlimitCPUSoftSetting) + m.Load(18, &x.cpuTimersEnabled) + m.Load(19, &x.timers) + m.Load(20, &x.nextTimerID) + m.Load(21, &x.exitedCPUStats) + m.Load(22, &x.childCPUStats) + m.Load(23, &x.ioUsage) + m.Load(24, &x.maxRSS) + m.Load(25, &x.childMaxRSS) + m.Load(26, &x.limits) + m.Load(27, &x.processGroup) + m.Load(28, &x.execed) + m.Load(30, &x.mounts) + m.Load(31, &x.tty) + m.Load(32, &x.oomScoreAdj) + m.LoadValue(29, new(*OldRSeqCriticalRegion), func(y interface{}) { x.loadOldRSeqCritical(y.(*OldRSeqCriticalRegion)) }) +} + +func (x *itimerRealListener) StateTypeName() string { + return "pkg/sentry/kernel.itimerRealListener" +} + +func (x *itimerRealListener) StateFields() []string { + return []string{ + "tg", + } } func (x *itimerRealListener) beforeSave() {} -func (x *itimerRealListener) save(m state.Map) { + +func (x *itimerRealListener) StateSave(m state.Sink) { x.beforeSave() - m.Save("tg", &x.tg) + m.Save(0, &x.tg) } func (x *itimerRealListener) afterLoad() {} -func (x *itimerRealListener) load(m state.Map) { - m.Load("tg", &x.tg) + +func (x *itimerRealListener) StateLoad(m state.Source) { + m.Load(0, &x.tg) +} + +func (x *TaskSet) StateTypeName() string { + return "pkg/sentry/kernel.TaskSet" +} + +func (x *TaskSet) StateFields() []string { + return []string{ + "Root", + "sessions", + } } func (x *TaskSet) beforeSave() {} -func (x *TaskSet) save(m state.Map) { + +func (x *TaskSet) StateSave(m state.Sink) { x.beforeSave() - m.Save("Root", &x.Root) - m.Save("sessions", &x.sessions) + m.Save(0, &x.Root) + m.Save(1, &x.sessions) } func (x *TaskSet) afterLoad() {} -func (x *TaskSet) load(m state.Map) { - m.Load("Root", &x.Root) - m.Load("sessions", &x.sessions) + +func (x *TaskSet) StateLoad(m state.Source) { + m.Load(0, &x.Root) + m.Load(1, &x.sessions) +} + +func (x *PIDNamespace) StateTypeName() string { + return "pkg/sentry/kernel.PIDNamespace" +} + +func (x *PIDNamespace) StateFields() []string { + return []string{ + "owner", + "parent", + "userns", + "last", + "tasks", + "tids", + "tgids", + "sessions", + "sids", + "processGroups", + "pgids", + "exiting", + } } func (x *PIDNamespace) beforeSave() {} -func (x *PIDNamespace) save(m state.Map) { - x.beforeSave() - m.Save("owner", &x.owner) - m.Save("parent", &x.parent) - m.Save("userns", &x.userns) - m.Save("last", &x.last) - m.Save("tasks", &x.tasks) - m.Save("tids", &x.tids) - m.Save("tgids", &x.tgids) - m.Save("sessions", &x.sessions) - m.Save("sids", &x.sids) - m.Save("processGroups", &x.processGroups) - m.Save("pgids", &x.pgids) - m.Save("exiting", &x.exiting) + +func (x *PIDNamespace) StateSave(m state.Sink) { + x.beforeSave() + m.Save(0, &x.owner) + m.Save(1, &x.parent) + m.Save(2, &x.userns) + m.Save(3, &x.last) + m.Save(4, &x.tasks) + m.Save(5, &x.tids) + m.Save(6, &x.tgids) + m.Save(7, &x.sessions) + m.Save(8, &x.sids) + m.Save(9, &x.processGroups) + m.Save(10, &x.pgids) + m.Save(11, &x.exiting) } func (x *PIDNamespace) afterLoad() {} -func (x *PIDNamespace) load(m state.Map) { - m.Load("owner", &x.owner) - m.Load("parent", &x.parent) - m.Load("userns", &x.userns) - m.Load("last", &x.last) - m.Load("tasks", &x.tasks) - m.Load("tids", &x.tids) - m.Load("tgids", &x.tgids) - m.Load("sessions", &x.sessions) - m.Load("sids", &x.sids) - m.Load("processGroups", &x.processGroups) - m.Load("pgids", &x.pgids) - m.Load("exiting", &x.exiting) + +func (x *PIDNamespace) StateLoad(m state.Source) { + m.Load(0, &x.owner) + m.Load(1, &x.parent) + m.Load(2, &x.userns) + m.Load(3, &x.last) + m.Load(4, &x.tasks) + m.Load(5, &x.tids) + m.Load(6, &x.tgids) + m.Load(7, &x.sessions) + m.Load(8, &x.sids) + m.Load(9, &x.processGroups) + m.Load(10, &x.pgids) + m.Load(11, &x.exiting) +} + +func (x *threadGroupNode) StateTypeName() string { + return "pkg/sentry/kernel.threadGroupNode" +} + +func (x *threadGroupNode) StateFields() []string { + return []string{ + "pidns", + "leader", + "execing", + "tasks", + "tasksCount", + "liveTasks", + "activeTasks", + } } func (x *threadGroupNode) beforeSave() {} -func (x *threadGroupNode) save(m state.Map) { + +func (x *threadGroupNode) StateSave(m state.Sink) { x.beforeSave() - m.Save("pidns", &x.pidns) - m.Save("leader", &x.leader) - m.Save("execing", &x.execing) - m.Save("tasks", &x.tasks) - m.Save("tasksCount", &x.tasksCount) - m.Save("liveTasks", &x.liveTasks) - m.Save("activeTasks", &x.activeTasks) + m.Save(0, &x.pidns) + m.Save(1, &x.leader) + m.Save(2, &x.execing) + m.Save(3, &x.tasks) + m.Save(4, &x.tasksCount) + m.Save(5, &x.liveTasks) + m.Save(6, &x.activeTasks) } func (x *threadGroupNode) afterLoad() {} -func (x *threadGroupNode) load(m state.Map) { - m.Load("pidns", &x.pidns) - m.Load("leader", &x.leader) - m.Load("execing", &x.execing) - m.Load("tasks", &x.tasks) - m.Load("tasksCount", &x.tasksCount) - m.Load("liveTasks", &x.liveTasks) - m.Load("activeTasks", &x.activeTasks) + +func (x *threadGroupNode) StateLoad(m state.Source) { + m.Load(0, &x.pidns) + m.Load(1, &x.leader) + m.Load(2, &x.execing) + m.Load(3, &x.tasks) + m.Load(4, &x.tasksCount) + m.Load(5, &x.liveTasks) + m.Load(6, &x.activeTasks) +} + +func (x *taskNode) StateTypeName() string { + return "pkg/sentry/kernel.taskNode" +} + +func (x *taskNode) StateFields() []string { + return []string{ + "tg", + "taskEntry", + "parent", + "children", + "childPIDNamespace", + } } func (x *taskNode) beforeSave() {} -func (x *taskNode) save(m state.Map) { + +func (x *taskNode) StateSave(m state.Sink) { x.beforeSave() - m.Save("tg", &x.tg) - m.Save("taskEntry", &x.taskEntry) - m.Save("parent", &x.parent) - m.Save("children", &x.children) - m.Save("childPIDNamespace", &x.childPIDNamespace) + m.Save(0, &x.tg) + m.Save(1, &x.taskEntry) + m.Save(2, &x.parent) + m.Save(3, &x.children) + m.Save(4, &x.childPIDNamespace) } func (x *taskNode) afterLoad() {} -func (x *taskNode) load(m state.Map) { - m.LoadWait("tg", &x.tg) - m.Load("taskEntry", &x.taskEntry) - m.Load("parent", &x.parent) - m.Load("children", &x.children) - m.Load("childPIDNamespace", &x.childPIDNamespace) + +func (x *taskNode) StateLoad(m state.Source) { + m.LoadWait(0, &x.tg) + m.Load(1, &x.taskEntry) + m.Load(2, &x.parent) + m.Load(3, &x.children) + m.Load(4, &x.childPIDNamespace) +} + +func (x *Timekeeper) StateTypeName() string { + return "pkg/sentry/kernel.Timekeeper" } -func (x *Timekeeper) save(m state.Map) { +func (x *Timekeeper) StateFields() []string { + return []string{ + "bootTime", + "saveMonotonic", + "saveRealtime", + "params", + } +} + +func (x *Timekeeper) StateSave(m state.Sink) { x.beforeSave() - m.Save("bootTime", &x.bootTime) - m.Save("saveMonotonic", &x.saveMonotonic) - m.Save("saveRealtime", &x.saveRealtime) - m.Save("params", &x.params) + m.Save(0, &x.bootTime) + m.Save(1, &x.saveMonotonic) + m.Save(2, &x.saveRealtime) + m.Save(3, &x.params) } -func (x *Timekeeper) load(m state.Map) { - m.Load("bootTime", &x.bootTime) - m.Load("saveMonotonic", &x.saveMonotonic) - m.Load("saveRealtime", &x.saveRealtime) - m.Load("params", &x.params) +func (x *Timekeeper) StateLoad(m state.Source) { + m.Load(0, &x.bootTime) + m.Load(1, &x.saveMonotonic) + m.Load(2, &x.saveRealtime) + m.Load(3, &x.params) m.AfterLoad(x.afterLoad) } +func (x *timekeeperClock) StateTypeName() string { + return "pkg/sentry/kernel.timekeeperClock" +} + +func (x *timekeeperClock) StateFields() []string { + return []string{ + "tk", + "c", + } +} + func (x *timekeeperClock) beforeSave() {} -func (x *timekeeperClock) save(m state.Map) { + +func (x *timekeeperClock) StateSave(m state.Sink) { x.beforeSave() - m.Save("tk", &x.tk) - m.Save("c", &x.c) + m.Save(0, &x.tk) + m.Save(1, &x.c) } func (x *timekeeperClock) afterLoad() {} -func (x *timekeeperClock) load(m state.Map) { - m.Load("tk", &x.tk) - m.Load("c", &x.c) + +func (x *timekeeperClock) StateLoad(m state.Source) { + m.Load(0, &x.tk) + m.Load(1, &x.c) +} + +func (x *TTY) StateTypeName() string { + return "pkg/sentry/kernel.TTY" +} + +func (x *TTY) StateFields() []string { + return []string{ + "Index", + "tg", + } } func (x *TTY) beforeSave() {} -func (x *TTY) save(m state.Map) { + +func (x *TTY) StateSave(m state.Sink) { x.beforeSave() - m.Save("Index", &x.Index) - m.Save("tg", &x.tg) + m.Save(0, &x.Index) + m.Save(1, &x.tg) } func (x *TTY) afterLoad() {} -func (x *TTY) load(m state.Map) { - m.Load("Index", &x.Index) - m.Load("tg", &x.tg) + +func (x *TTY) StateLoad(m state.Source) { + m.Load(0, &x.Index) + m.Load(1, &x.tg) +} + +func (x *UTSNamespace) StateTypeName() string { + return "pkg/sentry/kernel.UTSNamespace" +} + +func (x *UTSNamespace) StateFields() []string { + return []string{ + "hostName", + "domainName", + "userns", + } } func (x *UTSNamespace) beforeSave() {} -func (x *UTSNamespace) save(m state.Map) { + +func (x *UTSNamespace) StateSave(m state.Sink) { x.beforeSave() - m.Save("hostName", &x.hostName) - m.Save("domainName", &x.domainName) - m.Save("userns", &x.userns) + m.Save(0, &x.hostName) + m.Save(1, &x.domainName) + m.Save(2, &x.userns) } func (x *UTSNamespace) afterLoad() {} -func (x *UTSNamespace) load(m state.Map) { - m.Load("hostName", &x.hostName) - m.Load("domainName", &x.domainName) - m.Load("userns", &x.userns) + +func (x *UTSNamespace) StateLoad(m state.Source) { + m.Load(0, &x.hostName) + m.Load(1, &x.domainName) + m.Load(2, &x.userns) +} + +func (x *VDSOParamPage) StateTypeName() string { + return "pkg/sentry/kernel.VDSOParamPage" +} + +func (x *VDSOParamPage) StateFields() []string { + return []string{ + "mfp", + "fr", + "seq", + } } func (x *VDSOParamPage) beforeSave() {} -func (x *VDSOParamPage) save(m state.Map) { + +func (x *VDSOParamPage) StateSave(m state.Sink) { x.beforeSave() - m.Save("mfp", &x.mfp) - m.Save("fr", &x.fr) - m.Save("seq", &x.seq) + m.Save(0, &x.mfp) + m.Save(1, &x.fr) + m.Save(2, &x.seq) } func (x *VDSOParamPage) afterLoad() {} -func (x *VDSOParamPage) load(m state.Map) { - m.Load("mfp", &x.mfp) - m.Load("fr", &x.fr) - m.Load("seq", &x.seq) + +func (x *VDSOParamPage) StateLoad(m state.Source) { + m.Load(0, &x.mfp) + m.Load(1, &x.fr) + m.Load(2, &x.seq) } func init() { - state.Register("pkg/sentry/kernel.abstractEndpoint", (*abstractEndpoint)(nil), state.Fns{Save: (*abstractEndpoint).save, Load: (*abstractEndpoint).load}) - state.Register("pkg/sentry/kernel.AbstractSocketNamespace", (*AbstractSocketNamespace)(nil), state.Fns{Save: (*AbstractSocketNamespace).save, Load: (*AbstractSocketNamespace).load}) - state.Register("pkg/sentry/kernel.FDFlags", (*FDFlags)(nil), state.Fns{Save: (*FDFlags).save, Load: (*FDFlags).load}) - state.Register("pkg/sentry/kernel.descriptor", (*descriptor)(nil), state.Fns{Save: (*descriptor).save, Load: (*descriptor).load}) - state.Register("pkg/sentry/kernel.FDTable", (*FDTable)(nil), state.Fns{Save: (*FDTable).save, Load: (*FDTable).load}) - state.Register("pkg/sentry/kernel.FSContext", (*FSContext)(nil), state.Fns{Save: (*FSContext).save, Load: (*FSContext).load}) - state.Register("pkg/sentry/kernel.IPCNamespace", (*IPCNamespace)(nil), state.Fns{Save: (*IPCNamespace).save, Load: (*IPCNamespace).load}) - state.Register("pkg/sentry/kernel.Kernel", (*Kernel)(nil), state.Fns{Save: (*Kernel).save, Load: (*Kernel).load}) - state.Register("pkg/sentry/kernel.SocketEntry", (*SocketEntry)(nil), state.Fns{Save: (*SocketEntry).save, Load: (*SocketEntry).load}) - state.Register("pkg/sentry/kernel.pendingSignals", (*pendingSignals)(nil), state.Fns{Save: (*pendingSignals).save, Load: (*pendingSignals).load}) - state.Register("pkg/sentry/kernel.pendingSignalQueue", (*pendingSignalQueue)(nil), state.Fns{Save: (*pendingSignalQueue).save, Load: (*pendingSignalQueue).load}) - state.Register("pkg/sentry/kernel.pendingSignal", (*pendingSignal)(nil), state.Fns{Save: (*pendingSignal).save, Load: (*pendingSignal).load}) - state.Register("pkg/sentry/kernel.pendingSignalList", (*pendingSignalList)(nil), state.Fns{Save: (*pendingSignalList).save, Load: (*pendingSignalList).load}) - state.Register("pkg/sentry/kernel.pendingSignalEntry", (*pendingSignalEntry)(nil), state.Fns{Save: (*pendingSignalEntry).save, Load: (*pendingSignalEntry).load}) - state.Register("pkg/sentry/kernel.savedPendingSignal", (*savedPendingSignal)(nil), state.Fns{Save: (*savedPendingSignal).save, Load: (*savedPendingSignal).load}) - state.Register("pkg/sentry/kernel.IntervalTimer", (*IntervalTimer)(nil), state.Fns{Save: (*IntervalTimer).save, Load: (*IntervalTimer).load}) - state.Register("pkg/sentry/kernel.processGroupList", (*processGroupList)(nil), state.Fns{Save: (*processGroupList).save, Load: (*processGroupList).load}) - state.Register("pkg/sentry/kernel.processGroupEntry", (*processGroupEntry)(nil), state.Fns{Save: (*processGroupEntry).save, Load: (*processGroupEntry).load}) - state.Register("pkg/sentry/kernel.ptraceOptions", (*ptraceOptions)(nil), state.Fns{Save: (*ptraceOptions).save, Load: (*ptraceOptions).load}) - state.Register("pkg/sentry/kernel.ptraceStop", (*ptraceStop)(nil), state.Fns{Save: (*ptraceStop).save, Load: (*ptraceStop).load}) - state.Register("pkg/sentry/kernel.OldRSeqCriticalRegion", (*OldRSeqCriticalRegion)(nil), state.Fns{Save: (*OldRSeqCriticalRegion).save, Load: (*OldRSeqCriticalRegion).load}) - state.Register("pkg/sentry/kernel.sessionList", (*sessionList)(nil), state.Fns{Save: (*sessionList).save, Load: (*sessionList).load}) - state.Register("pkg/sentry/kernel.sessionEntry", (*sessionEntry)(nil), state.Fns{Save: (*sessionEntry).save, Load: (*sessionEntry).load}) - state.Register("pkg/sentry/kernel.Session", (*Session)(nil), state.Fns{Save: (*Session).save, Load: (*Session).load}) - state.Register("pkg/sentry/kernel.ProcessGroup", (*ProcessGroup)(nil), state.Fns{Save: (*ProcessGroup).save, Load: (*ProcessGroup).load}) - state.Register("pkg/sentry/kernel.SignalHandlers", (*SignalHandlers)(nil), state.Fns{Save: (*SignalHandlers).save, Load: (*SignalHandlers).load}) - state.Register("pkg/sentry/kernel.socketList", (*socketList)(nil), state.Fns{Save: (*socketList).save, Load: (*socketList).load}) - state.Register("pkg/sentry/kernel.socketEntry", (*socketEntry)(nil), state.Fns{Save: (*socketEntry).save, Load: (*socketEntry).load}) - state.Register("pkg/sentry/kernel.syscallTableInfo", (*syscallTableInfo)(nil), state.Fns{Save: (*syscallTableInfo).save, Load: (*syscallTableInfo).load}) - state.Register("pkg/sentry/kernel.syslog", (*syslog)(nil), state.Fns{Save: (*syslog).save, Load: (*syslog).load}) - state.Register("pkg/sentry/kernel.Task", (*Task)(nil), state.Fns{Save: (*Task).save, Load: (*Task).load}) - state.Register("pkg/sentry/kernel.runSyscallAfterPtraceEventClone", (*runSyscallAfterPtraceEventClone)(nil), state.Fns{Save: (*runSyscallAfterPtraceEventClone).save, Load: (*runSyscallAfterPtraceEventClone).load}) - state.Register("pkg/sentry/kernel.runSyscallAfterVforkStop", (*runSyscallAfterVforkStop)(nil), state.Fns{Save: (*runSyscallAfterVforkStop).save, Load: (*runSyscallAfterVforkStop).load}) - state.Register("pkg/sentry/kernel.vforkStop", (*vforkStop)(nil), state.Fns{Save: (*vforkStop).save, Load: (*vforkStop).load}) - state.Register("pkg/sentry/kernel.TaskContext", (*TaskContext)(nil), state.Fns{Save: (*TaskContext).save, Load: (*TaskContext).load}) - state.Register("pkg/sentry/kernel.execStop", (*execStop)(nil), state.Fns{Save: (*execStop).save, Load: (*execStop).load}) - state.Register("pkg/sentry/kernel.runSyscallAfterExecStop", (*runSyscallAfterExecStop)(nil), state.Fns{Save: (*runSyscallAfterExecStop).save, Load: (*runSyscallAfterExecStop).load}) - state.Register("pkg/sentry/kernel.ExitStatus", (*ExitStatus)(nil), state.Fns{Save: (*ExitStatus).save, Load: (*ExitStatus).load}) - state.Register("pkg/sentry/kernel.runExit", (*runExit)(nil), state.Fns{Save: (*runExit).save, Load: (*runExit).load}) - state.Register("pkg/sentry/kernel.runExitMain", (*runExitMain)(nil), state.Fns{Save: (*runExitMain).save, Load: (*runExitMain).load}) - state.Register("pkg/sentry/kernel.runExitNotify", (*runExitNotify)(nil), state.Fns{Save: (*runExitNotify).save, Load: (*runExitNotify).load}) - state.Register("pkg/sentry/kernel.taskList", (*taskList)(nil), state.Fns{Save: (*taskList).save, Load: (*taskList).load}) - state.Register("pkg/sentry/kernel.taskEntry", (*taskEntry)(nil), state.Fns{Save: (*taskEntry).save, Load: (*taskEntry).load}) - state.Register("pkg/sentry/kernel.runApp", (*runApp)(nil), state.Fns{Save: (*runApp).save, Load: (*runApp).load}) - state.Register("pkg/sentry/kernel.TaskGoroutineSchedInfo", (*TaskGoroutineSchedInfo)(nil), state.Fns{Save: (*TaskGoroutineSchedInfo).save, Load: (*TaskGoroutineSchedInfo).load}) - state.Register("pkg/sentry/kernel.taskClock", (*taskClock)(nil), state.Fns{Save: (*taskClock).save, Load: (*taskClock).load}) - state.Register("pkg/sentry/kernel.tgClock", (*tgClock)(nil), state.Fns{Save: (*tgClock).save, Load: (*tgClock).load}) - state.Register("pkg/sentry/kernel.groupStop", (*groupStop)(nil), state.Fns{Save: (*groupStop).save, Load: (*groupStop).load}) - state.Register("pkg/sentry/kernel.runInterrupt", (*runInterrupt)(nil), state.Fns{Save: (*runInterrupt).save, Load: (*runInterrupt).load}) - state.Register("pkg/sentry/kernel.runInterruptAfterSignalDeliveryStop", (*runInterruptAfterSignalDeliveryStop)(nil), state.Fns{Save: (*runInterruptAfterSignalDeliveryStop).save, Load: (*runInterruptAfterSignalDeliveryStop).load}) - state.Register("pkg/sentry/kernel.runSyscallAfterSyscallEnterStop", (*runSyscallAfterSyscallEnterStop)(nil), state.Fns{Save: (*runSyscallAfterSyscallEnterStop).save, Load: (*runSyscallAfterSyscallEnterStop).load}) - state.Register("pkg/sentry/kernel.runSyscallAfterSysemuStop", (*runSyscallAfterSysemuStop)(nil), state.Fns{Save: (*runSyscallAfterSysemuStop).save, Load: (*runSyscallAfterSysemuStop).load}) - state.Register("pkg/sentry/kernel.runSyscallReinvoke", (*runSyscallReinvoke)(nil), state.Fns{Save: (*runSyscallReinvoke).save, Load: (*runSyscallReinvoke).load}) - state.Register("pkg/sentry/kernel.runSyscallExit", (*runSyscallExit)(nil), state.Fns{Save: (*runSyscallExit).save, Load: (*runSyscallExit).load}) - state.Register("pkg/sentry/kernel.ThreadGroup", (*ThreadGroup)(nil), state.Fns{Save: (*ThreadGroup).save, Load: (*ThreadGroup).load}) - state.Register("pkg/sentry/kernel.itimerRealListener", (*itimerRealListener)(nil), state.Fns{Save: (*itimerRealListener).save, Load: (*itimerRealListener).load}) - state.Register("pkg/sentry/kernel.TaskSet", (*TaskSet)(nil), state.Fns{Save: (*TaskSet).save, Load: (*TaskSet).load}) - state.Register("pkg/sentry/kernel.PIDNamespace", (*PIDNamespace)(nil), state.Fns{Save: (*PIDNamespace).save, Load: (*PIDNamespace).load}) - state.Register("pkg/sentry/kernel.threadGroupNode", (*threadGroupNode)(nil), state.Fns{Save: (*threadGroupNode).save, Load: (*threadGroupNode).load}) - state.Register("pkg/sentry/kernel.taskNode", (*taskNode)(nil), state.Fns{Save: (*taskNode).save, Load: (*taskNode).load}) - state.Register("pkg/sentry/kernel.Timekeeper", (*Timekeeper)(nil), state.Fns{Save: (*Timekeeper).save, Load: (*Timekeeper).load}) - state.Register("pkg/sentry/kernel.timekeeperClock", (*timekeeperClock)(nil), state.Fns{Save: (*timekeeperClock).save, Load: (*timekeeperClock).load}) - state.Register("pkg/sentry/kernel.TTY", (*TTY)(nil), state.Fns{Save: (*TTY).save, Load: (*TTY).load}) - state.Register("pkg/sentry/kernel.UTSNamespace", (*UTSNamespace)(nil), state.Fns{Save: (*UTSNamespace).save, Load: (*UTSNamespace).load}) - state.Register("pkg/sentry/kernel.VDSOParamPage", (*VDSOParamPage)(nil), state.Fns{Save: (*VDSOParamPage).save, Load: (*VDSOParamPage).load}) + state.Register((*abstractEndpoint)(nil)) + state.Register((*AbstractSocketNamespace)(nil)) + state.Register((*FDFlags)(nil)) + state.Register((*descriptor)(nil)) + state.Register((*FDTable)(nil)) + state.Register((*FSContext)(nil)) + state.Register((*IPCNamespace)(nil)) + state.Register((*Kernel)(nil)) + state.Register((*SocketEntry)(nil)) + state.Register((*pendingSignals)(nil)) + state.Register((*pendingSignalQueue)(nil)) + state.Register((*pendingSignal)(nil)) + state.Register((*pendingSignalList)(nil)) + state.Register((*pendingSignalEntry)(nil)) + state.Register((*savedPendingSignal)(nil)) + state.Register((*IntervalTimer)(nil)) + state.Register((*processGroupList)(nil)) + state.Register((*processGroupEntry)(nil)) + state.Register((*ptraceOptions)(nil)) + state.Register((*ptraceStop)(nil)) + state.Register((*OldRSeqCriticalRegion)(nil)) + state.Register((*sessionList)(nil)) + state.Register((*sessionEntry)(nil)) + state.Register((*Session)(nil)) + state.Register((*ProcessGroup)(nil)) + state.Register((*SignalHandlers)(nil)) + state.Register((*socketList)(nil)) + state.Register((*socketEntry)(nil)) + state.Register((*syscallTableInfo)(nil)) + state.Register((*syslog)(nil)) + state.Register((*Task)(nil)) + state.Register((*runSyscallAfterPtraceEventClone)(nil)) + state.Register((*runSyscallAfterVforkStop)(nil)) + state.Register((*vforkStop)(nil)) + state.Register((*TaskContext)(nil)) + state.Register((*execStop)(nil)) + state.Register((*runSyscallAfterExecStop)(nil)) + state.Register((*ExitStatus)(nil)) + state.Register((*runExit)(nil)) + state.Register((*runExitMain)(nil)) + state.Register((*runExitNotify)(nil)) + state.Register((*taskList)(nil)) + state.Register((*taskEntry)(nil)) + state.Register((*runApp)(nil)) + state.Register((*TaskGoroutineSchedInfo)(nil)) + state.Register((*taskClock)(nil)) + state.Register((*tgClock)(nil)) + state.Register((*groupStop)(nil)) + state.Register((*runInterrupt)(nil)) + state.Register((*runInterruptAfterSignalDeliveryStop)(nil)) + state.Register((*runSyscallAfterSyscallEnterStop)(nil)) + state.Register((*runSyscallAfterSysemuStop)(nil)) + state.Register((*runSyscallReinvoke)(nil)) + state.Register((*runSyscallExit)(nil)) + state.Register((*ThreadGroup)(nil)) + state.Register((*itimerRealListener)(nil)) + state.Register((*TaskSet)(nil)) + state.Register((*PIDNamespace)(nil)) + state.Register((*threadGroupNode)(nil)) + state.Register((*taskNode)(nil)) + state.Register((*Timekeeper)(nil)) + state.Register((*timekeeperClock)(nil)) + state.Register((*TTY)(nil)) + state.Register((*UTSNamespace)(nil)) + state.Register((*VDSOParamPage)(nil)) } diff --git a/pkg/sentry/kernel/pending_signals_list.go b/pkg/sentry/kernel/pending_signals_list.go index 2685c631a..d0062087a 100644 --- a/pkg/sentry/kernel/pending_signals_list.go +++ b/pkg/sentry/kernel/pending_signals_list.go @@ -56,7 +56,7 @@ func (l *pendingSignalList) Back() *pendingSignal { // // NOTE: This is an O(n) operation. func (l *pendingSignalList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (pendingSignalElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *pendingSignalList) Remove(e *pendingSignal) { if prev != nil { pendingSignalElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { pendingSignalElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/kernel/pipe/pipe_state_autogen.go b/pkg/sentry/kernel/pipe/pipe_state_autogen.go index b49ab46f9..df55abce6 100644 --- a/pkg/sentry/kernel/pipe/pipe_state_autogen.go +++ b/pkg/sentry/kernel/pipe/pipe_state_autogen.go @@ -6,79 +6,146 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *inodeOperations) StateTypeName() string { + return "pkg/sentry/kernel/pipe.inodeOperations" +} + +func (x *inodeOperations) StateFields() []string { + return []string{ + "InodeSimpleAttributes", + "p", + } +} + func (x *inodeOperations) beforeSave() {} -func (x *inodeOperations) save(m state.Map) { + +func (x *inodeOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Save("p", &x.p) + m.Save(0, &x.InodeSimpleAttributes) + m.Save(1, &x.p) } func (x *inodeOperations) afterLoad() {} -func (x *inodeOperations) load(m state.Map) { - m.Load("InodeSimpleAttributes", &x.InodeSimpleAttributes) - m.Load("p", &x.p) + +func (x *inodeOperations) StateLoad(m state.Source) { + m.Load(0, &x.InodeSimpleAttributes) + m.Load(1, &x.p) +} + +func (x *Pipe) StateTypeName() string { + return "pkg/sentry/kernel/pipe.Pipe" +} + +func (x *Pipe) StateFields() []string { + return []string{ + "isNamed", + "atomicIOBytes", + "readers", + "writers", + "view", + "max", + "hadWriter", + } } func (x *Pipe) beforeSave() {} -func (x *Pipe) save(m state.Map) { + +func (x *Pipe) StateSave(m state.Sink) { x.beforeSave() - m.Save("isNamed", &x.isNamed) - m.Save("atomicIOBytes", &x.atomicIOBytes) - m.Save("readers", &x.readers) - m.Save("writers", &x.writers) - m.Save("view", &x.view) - m.Save("max", &x.max) - m.Save("hadWriter", &x.hadWriter) + m.Save(0, &x.isNamed) + m.Save(1, &x.atomicIOBytes) + m.Save(2, &x.readers) + m.Save(3, &x.writers) + m.Save(4, &x.view) + m.Save(5, &x.max) + m.Save(6, &x.hadWriter) } func (x *Pipe) afterLoad() {} -func (x *Pipe) load(m state.Map) { - m.Load("isNamed", &x.isNamed) - m.Load("atomicIOBytes", &x.atomicIOBytes) - m.Load("readers", &x.readers) - m.Load("writers", &x.writers) - m.Load("view", &x.view) - m.Load("max", &x.max) - m.Load("hadWriter", &x.hadWriter) + +func (x *Pipe) StateLoad(m state.Source) { + m.Load(0, &x.isNamed) + m.Load(1, &x.atomicIOBytes) + m.Load(2, &x.readers) + m.Load(3, &x.writers) + m.Load(4, &x.view) + m.Load(5, &x.max) + m.Load(6, &x.hadWriter) +} + +func (x *Reader) StateTypeName() string { + return "pkg/sentry/kernel/pipe.Reader" +} + +func (x *Reader) StateFields() []string { + return []string{ + "ReaderWriter", + } } func (x *Reader) beforeSave() {} -func (x *Reader) save(m state.Map) { + +func (x *Reader) StateSave(m state.Sink) { x.beforeSave() - m.Save("ReaderWriter", &x.ReaderWriter) + m.Save(0, &x.ReaderWriter) } func (x *Reader) afterLoad() {} -func (x *Reader) load(m state.Map) { - m.Load("ReaderWriter", &x.ReaderWriter) + +func (x *Reader) StateLoad(m state.Source) { + m.Load(0, &x.ReaderWriter) +} + +func (x *ReaderWriter) StateTypeName() string { + return "pkg/sentry/kernel/pipe.ReaderWriter" +} + +func (x *ReaderWriter) StateFields() []string { + return []string{ + "Pipe", + } } func (x *ReaderWriter) beforeSave() {} -func (x *ReaderWriter) save(m state.Map) { + +func (x *ReaderWriter) StateSave(m state.Sink) { x.beforeSave() - m.Save("Pipe", &x.Pipe) + m.Save(0, &x.Pipe) } func (x *ReaderWriter) afterLoad() {} -func (x *ReaderWriter) load(m state.Map) { - m.Load("Pipe", &x.Pipe) + +func (x *ReaderWriter) StateLoad(m state.Source) { + m.Load(0, &x.Pipe) +} + +func (x *Writer) StateTypeName() string { + return "pkg/sentry/kernel/pipe.Writer" +} + +func (x *Writer) StateFields() []string { + return []string{ + "ReaderWriter", + } } func (x *Writer) beforeSave() {} -func (x *Writer) save(m state.Map) { + +func (x *Writer) StateSave(m state.Sink) { x.beforeSave() - m.Save("ReaderWriter", &x.ReaderWriter) + m.Save(0, &x.ReaderWriter) } func (x *Writer) afterLoad() {} -func (x *Writer) load(m state.Map) { - m.Load("ReaderWriter", &x.ReaderWriter) + +func (x *Writer) StateLoad(m state.Source) { + m.Load(0, &x.ReaderWriter) } func init() { - state.Register("pkg/sentry/kernel/pipe.inodeOperations", (*inodeOperations)(nil), state.Fns{Save: (*inodeOperations).save, Load: (*inodeOperations).load}) - state.Register("pkg/sentry/kernel/pipe.Pipe", (*Pipe)(nil), state.Fns{Save: (*Pipe).save, Load: (*Pipe).load}) - state.Register("pkg/sentry/kernel/pipe.Reader", (*Reader)(nil), state.Fns{Save: (*Reader).save, Load: (*Reader).load}) - state.Register("pkg/sentry/kernel/pipe.ReaderWriter", (*ReaderWriter)(nil), state.Fns{Save: (*ReaderWriter).save, Load: (*ReaderWriter).load}) - state.Register("pkg/sentry/kernel/pipe.Writer", (*Writer)(nil), state.Fns{Save: (*Writer).save, Load: (*Writer).load}) + state.Register((*inodeOperations)(nil)) + state.Register((*Pipe)(nil)) + state.Register((*Reader)(nil)) + state.Register((*ReaderWriter)(nil)) + state.Register((*Writer)(nil)) } diff --git a/pkg/sentry/kernel/process_group_list.go b/pkg/sentry/kernel/process_group_list.go index 3c5ea8aa7..bc2df5bce 100644 --- a/pkg/sentry/kernel/process_group_list.go +++ b/pkg/sentry/kernel/process_group_list.go @@ -56,7 +56,7 @@ func (l *processGroupList) Back() *ProcessGroup { // // NOTE: This is an O(n) operation. func (l *processGroupList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (processGroupElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *processGroupList) Remove(e *ProcessGroup) { if prev != nil { processGroupElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { processGroupElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go b/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go index ba1d073d9..fe5adfbee 100644 --- a/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go +++ b/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go @@ -6,112 +6,200 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Registry) StateTypeName() string { + return "pkg/sentry/kernel/semaphore.Registry" +} + +func (x *Registry) StateFields() []string { + return []string{ + "userNS", + "semaphores", + "lastIDUsed", + } +} + func (x *Registry) beforeSave() {} -func (x *Registry) save(m state.Map) { + +func (x *Registry) StateSave(m state.Sink) { x.beforeSave() - m.Save("userNS", &x.userNS) - m.Save("semaphores", &x.semaphores) - m.Save("lastIDUsed", &x.lastIDUsed) + m.Save(0, &x.userNS) + m.Save(1, &x.semaphores) + m.Save(2, &x.lastIDUsed) } func (x *Registry) afterLoad() {} -func (x *Registry) load(m state.Map) { - m.Load("userNS", &x.userNS) - m.Load("semaphores", &x.semaphores) - m.Load("lastIDUsed", &x.lastIDUsed) + +func (x *Registry) StateLoad(m state.Source) { + m.Load(0, &x.userNS) + m.Load(1, &x.semaphores) + m.Load(2, &x.lastIDUsed) +} + +func (x *Set) StateTypeName() string { + return "pkg/sentry/kernel/semaphore.Set" +} + +func (x *Set) StateFields() []string { + return []string{ + "registry", + "ID", + "key", + "creator", + "owner", + "perms", + "opTime", + "changeTime", + "sems", + "dead", + } } func (x *Set) beforeSave() {} -func (x *Set) save(m state.Map) { + +func (x *Set) StateSave(m state.Sink) { x.beforeSave() - m.Save("registry", &x.registry) - m.Save("ID", &x.ID) - m.Save("key", &x.key) - m.Save("creator", &x.creator) - m.Save("owner", &x.owner) - m.Save("perms", &x.perms) - m.Save("opTime", &x.opTime) - m.Save("changeTime", &x.changeTime) - m.Save("sems", &x.sems) - m.Save("dead", &x.dead) + m.Save(0, &x.registry) + m.Save(1, &x.ID) + m.Save(2, &x.key) + m.Save(3, &x.creator) + m.Save(4, &x.owner) + m.Save(5, &x.perms) + m.Save(6, &x.opTime) + m.Save(7, &x.changeTime) + m.Save(8, &x.sems) + m.Save(9, &x.dead) } func (x *Set) afterLoad() {} -func (x *Set) load(m state.Map) { - m.Load("registry", &x.registry) - m.Load("ID", &x.ID) - m.Load("key", &x.key) - m.Load("creator", &x.creator) - m.Load("owner", &x.owner) - m.Load("perms", &x.perms) - m.Load("opTime", &x.opTime) - m.Load("changeTime", &x.changeTime) - m.Load("sems", &x.sems) - m.Load("dead", &x.dead) + +func (x *Set) StateLoad(m state.Source) { + m.Load(0, &x.registry) + m.Load(1, &x.ID) + m.Load(2, &x.key) + m.Load(3, &x.creator) + m.Load(4, &x.owner) + m.Load(5, &x.perms) + m.Load(6, &x.opTime) + m.Load(7, &x.changeTime) + m.Load(8, &x.sems) + m.Load(9, &x.dead) +} + +func (x *sem) StateTypeName() string { + return "pkg/sentry/kernel/semaphore.sem" +} + +func (x *sem) StateFields() []string { + return []string{ + "value", + "pid", + } } func (x *sem) beforeSave() {} -func (x *sem) save(m state.Map) { + +func (x *sem) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.waiters) { - m.Failf("waiters is %#v, expected zero", &x.waiters) + state.Failf("waiters is %#v, expected zero", &x.waiters) } - m.Save("value", &x.value) - m.Save("pid", &x.pid) + m.Save(0, &x.value) + m.Save(1, &x.pid) } func (x *sem) afterLoad() {} -func (x *sem) load(m state.Map) { - m.Load("value", &x.value) - m.Load("pid", &x.pid) + +func (x *sem) StateLoad(m state.Source) { + m.Load(0, &x.value) + m.Load(1, &x.pid) +} + +func (x *waiter) StateTypeName() string { + return "pkg/sentry/kernel/semaphore.waiter" +} + +func (x *waiter) StateFields() []string { + return []string{ + "waiterEntry", + "value", + "ch", + } } func (x *waiter) beforeSave() {} -func (x *waiter) save(m state.Map) { + +func (x *waiter) StateSave(m state.Sink) { x.beforeSave() - m.Save("waiterEntry", &x.waiterEntry) - m.Save("value", &x.value) - m.Save("ch", &x.ch) + m.Save(0, &x.waiterEntry) + m.Save(1, &x.value) + m.Save(2, &x.ch) } func (x *waiter) afterLoad() {} -func (x *waiter) load(m state.Map) { - m.Load("waiterEntry", &x.waiterEntry) - m.Load("value", &x.value) - m.Load("ch", &x.ch) + +func (x *waiter) StateLoad(m state.Source) { + m.Load(0, &x.waiterEntry) + m.Load(1, &x.value) + m.Load(2, &x.ch) +} + +func (x *waiterList) StateTypeName() string { + return "pkg/sentry/kernel/semaphore.waiterList" +} + +func (x *waiterList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *waiterList) beforeSave() {} -func (x *waiterList) save(m state.Map) { + +func (x *waiterList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *waiterList) afterLoad() {} -func (x *waiterList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *waiterList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *waiterEntry) StateTypeName() string { + return "pkg/sentry/kernel/semaphore.waiterEntry" +} + +func (x *waiterEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *waiterEntry) beforeSave() {} -func (x *waiterEntry) save(m state.Map) { + +func (x *waiterEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *waiterEntry) afterLoad() {} -func (x *waiterEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *waiterEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) } func init() { - state.Register("pkg/sentry/kernel/semaphore.Registry", (*Registry)(nil), state.Fns{Save: (*Registry).save, Load: (*Registry).load}) - state.Register("pkg/sentry/kernel/semaphore.Set", (*Set)(nil), state.Fns{Save: (*Set).save, Load: (*Set).load}) - state.Register("pkg/sentry/kernel/semaphore.sem", (*sem)(nil), state.Fns{Save: (*sem).save, Load: (*sem).load}) - state.Register("pkg/sentry/kernel/semaphore.waiter", (*waiter)(nil), state.Fns{Save: (*waiter).save, Load: (*waiter).load}) - state.Register("pkg/sentry/kernel/semaphore.waiterList", (*waiterList)(nil), state.Fns{Save: (*waiterList).save, Load: (*waiterList).load}) - state.Register("pkg/sentry/kernel/semaphore.waiterEntry", (*waiterEntry)(nil), state.Fns{Save: (*waiterEntry).save, Load: (*waiterEntry).load}) + state.Register((*Registry)(nil)) + state.Register((*Set)(nil)) + state.Register((*sem)(nil)) + state.Register((*waiter)(nil)) + state.Register((*waiterList)(nil)) + state.Register((*waiterEntry)(nil)) } diff --git a/pkg/sentry/kernel/semaphore/waiter_list.go b/pkg/sentry/kernel/semaphore/waiter_list.go index 4bfe5ff95..007bf67b0 100644 --- a/pkg/sentry/kernel/semaphore/waiter_list.go +++ b/pkg/sentry/kernel/semaphore/waiter_list.go @@ -56,7 +56,7 @@ func (l *waiterList) Back() *waiter { // // NOTE: This is an O(n) operation. func (l *waiterList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (waiterElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *waiterList) Remove(e *waiter) { if prev != nil { waiterElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { waiterElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/kernel/session_list.go b/pkg/sentry/kernel/session_list.go index 768482ab6..c328b2526 100644 --- a/pkg/sentry/kernel/session_list.go +++ b/pkg/sentry/kernel/session_list.go @@ -56,7 +56,7 @@ func (l *sessionList) Back() *Session { // // NOTE: This is an O(n) operation. func (l *sessionList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (sessionElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *sessionList) Remove(e *Session) { if prev != nil { sessionElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { sessionElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/kernel/shm/shm_state_autogen.go b/pkg/sentry/kernel/shm/shm_state_autogen.go index fa8f896f7..c98632087 100644 --- a/pkg/sentry/kernel/shm/shm_state_autogen.go +++ b/pkg/sentry/kernel/shm/shm_state_autogen.go @@ -6,69 +6,113 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Registry) StateTypeName() string { + return "pkg/sentry/kernel/shm.Registry" +} + +func (x *Registry) StateFields() []string { + return []string{ + "userNS", + "shms", + "keysToShms", + "totalPages", + "lastIDUsed", + } +} + func (x *Registry) beforeSave() {} -func (x *Registry) save(m state.Map) { + +func (x *Registry) StateSave(m state.Sink) { x.beforeSave() - m.Save("userNS", &x.userNS) - m.Save("shms", &x.shms) - m.Save("keysToShms", &x.keysToShms) - m.Save("totalPages", &x.totalPages) - m.Save("lastIDUsed", &x.lastIDUsed) + m.Save(0, &x.userNS) + m.Save(1, &x.shms) + m.Save(2, &x.keysToShms) + m.Save(3, &x.totalPages) + m.Save(4, &x.lastIDUsed) } func (x *Registry) afterLoad() {} -func (x *Registry) load(m state.Map) { - m.Load("userNS", &x.userNS) - m.Load("shms", &x.shms) - m.Load("keysToShms", &x.keysToShms) - m.Load("totalPages", &x.totalPages) - m.Load("lastIDUsed", &x.lastIDUsed) + +func (x *Registry) StateLoad(m state.Source) { + m.Load(0, &x.userNS) + m.Load(1, &x.shms) + m.Load(2, &x.keysToShms) + m.Load(3, &x.totalPages) + m.Load(4, &x.lastIDUsed) +} + +func (x *Shm) StateTypeName() string { + return "pkg/sentry/kernel/shm.Shm" +} + +func (x *Shm) StateFields() []string { + return []string{ + "AtomicRefCount", + "mfp", + "registry", + "ID", + "creator", + "size", + "effectiveSize", + "fr", + "key", + "perms", + "owner", + "attachTime", + "detachTime", + "changeTime", + "creatorPID", + "lastAttachDetachPID", + "pendingDestruction", + } } func (x *Shm) beforeSave() {} -func (x *Shm) save(m state.Map) { + +func (x *Shm) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("mfp", &x.mfp) - m.Save("registry", &x.registry) - m.Save("ID", &x.ID) - m.Save("creator", &x.creator) - m.Save("size", &x.size) - m.Save("effectiveSize", &x.effectiveSize) - m.Save("fr", &x.fr) - m.Save("key", &x.key) - m.Save("perms", &x.perms) - m.Save("owner", &x.owner) - m.Save("attachTime", &x.attachTime) - m.Save("detachTime", &x.detachTime) - m.Save("changeTime", &x.changeTime) - m.Save("creatorPID", &x.creatorPID) - m.Save("lastAttachDetachPID", &x.lastAttachDetachPID) - m.Save("pendingDestruction", &x.pendingDestruction) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.mfp) + m.Save(2, &x.registry) + m.Save(3, &x.ID) + m.Save(4, &x.creator) + m.Save(5, &x.size) + m.Save(6, &x.effectiveSize) + m.Save(7, &x.fr) + m.Save(8, &x.key) + m.Save(9, &x.perms) + m.Save(10, &x.owner) + m.Save(11, &x.attachTime) + m.Save(12, &x.detachTime) + m.Save(13, &x.changeTime) + m.Save(14, &x.creatorPID) + m.Save(15, &x.lastAttachDetachPID) + m.Save(16, &x.pendingDestruction) } func (x *Shm) afterLoad() {} -func (x *Shm) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("mfp", &x.mfp) - m.Load("registry", &x.registry) - m.Load("ID", &x.ID) - m.Load("creator", &x.creator) - m.Load("size", &x.size) - m.Load("effectiveSize", &x.effectiveSize) - m.Load("fr", &x.fr) - m.Load("key", &x.key) - m.Load("perms", &x.perms) - m.Load("owner", &x.owner) - m.Load("attachTime", &x.attachTime) - m.Load("detachTime", &x.detachTime) - m.Load("changeTime", &x.changeTime) - m.Load("creatorPID", &x.creatorPID) - m.Load("lastAttachDetachPID", &x.lastAttachDetachPID) - m.Load("pendingDestruction", &x.pendingDestruction) + +func (x *Shm) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.mfp) + m.Load(2, &x.registry) + m.Load(3, &x.ID) + m.Load(4, &x.creator) + m.Load(5, &x.size) + m.Load(6, &x.effectiveSize) + m.Load(7, &x.fr) + m.Load(8, &x.key) + m.Load(9, &x.perms) + m.Load(10, &x.owner) + m.Load(11, &x.attachTime) + m.Load(12, &x.detachTime) + m.Load(13, &x.changeTime) + m.Load(14, &x.creatorPID) + m.Load(15, &x.lastAttachDetachPID) + m.Load(16, &x.pendingDestruction) } func init() { - state.Register("pkg/sentry/kernel/shm.Registry", (*Registry)(nil), state.Fns{Save: (*Registry).save, Load: (*Registry).load}) - state.Register("pkg/sentry/kernel/shm.Shm", (*Shm)(nil), state.Fns{Save: (*Shm).save, Load: (*Shm).load}) + state.Register((*Registry)(nil)) + state.Register((*Shm)(nil)) } diff --git a/pkg/sentry/kernel/signalfd/signalfd_state_autogen.go b/pkg/sentry/kernel/signalfd/signalfd_state_autogen.go index 2ab5b4702..089a35b60 100644 --- a/pkg/sentry/kernel/signalfd/signalfd_state_autogen.go +++ b/pkg/sentry/kernel/signalfd/signalfd_state_autogen.go @@ -6,19 +6,32 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SignalOperations) StateTypeName() string { + return "pkg/sentry/kernel/signalfd.SignalOperations" +} + +func (x *SignalOperations) StateFields() []string { + return []string{ + "target", + "mask", + } +} + func (x *SignalOperations) beforeSave() {} -func (x *SignalOperations) save(m state.Map) { + +func (x *SignalOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("target", &x.target) - m.Save("mask", &x.mask) + m.Save(0, &x.target) + m.Save(1, &x.mask) } func (x *SignalOperations) afterLoad() {} -func (x *SignalOperations) load(m state.Map) { - m.Load("target", &x.target) - m.Load("mask", &x.mask) + +func (x *SignalOperations) StateLoad(m state.Source) { + m.Load(0, &x.target) + m.Load(1, &x.mask) } func init() { - state.Register("pkg/sentry/kernel/signalfd.SignalOperations", (*SignalOperations)(nil), state.Fns{Save: (*SignalOperations).save, Load: (*SignalOperations).load}) + state.Register((*SignalOperations)(nil)) } diff --git a/pkg/sentry/kernel/socket_list.go b/pkg/sentry/kernel/socket_list.go index 294aa99fe..d2d4307a1 100644 --- a/pkg/sentry/kernel/socket_list.go +++ b/pkg/sentry/kernel/socket_list.go @@ -56,7 +56,7 @@ func (l *socketList) Back() *SocketEntry { // // NOTE: This is an O(n) operation. func (l *socketList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (socketElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *socketList) Remove(e *SocketEntry) { if prev != nil { socketElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { socketElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/kernel/task_list.go b/pkg/sentry/kernel/task_list.go index e7a3a3d20..f0c501845 100644 --- a/pkg/sentry/kernel/task_list.go +++ b/pkg/sentry/kernel/task_list.go @@ -56,7 +56,7 @@ func (l *taskList) Back() *Task { // // NOTE: This is an O(n) operation. func (l *taskList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (taskElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *taskList) Remove(e *Task) { if prev != nil { taskElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { taskElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/kernel/time/time_state_autogen.go b/pkg/sentry/kernel/time/time_state_autogen.go index ab6c6633d..4fb37df9a 100644 --- a/pkg/sentry/kernel/time/time_state_autogen.go +++ b/pkg/sentry/kernel/time/time_state_autogen.go @@ -6,51 +6,92 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Time) StateTypeName() string { + return "pkg/sentry/kernel/time.Time" +} + +func (x *Time) StateFields() []string { + return []string{ + "ns", + } +} + func (x *Time) beforeSave() {} -func (x *Time) save(m state.Map) { + +func (x *Time) StateSave(m state.Sink) { x.beforeSave() - m.Save("ns", &x.ns) + m.Save(0, &x.ns) } func (x *Time) afterLoad() {} -func (x *Time) load(m state.Map) { - m.Load("ns", &x.ns) + +func (x *Time) StateLoad(m state.Source) { + m.Load(0, &x.ns) +} + +func (x *Setting) StateTypeName() string { + return "pkg/sentry/kernel/time.Setting" +} + +func (x *Setting) StateFields() []string { + return []string{ + "Enabled", + "Next", + "Period", + } } func (x *Setting) beforeSave() {} -func (x *Setting) save(m state.Map) { + +func (x *Setting) StateSave(m state.Sink) { x.beforeSave() - m.Save("Enabled", &x.Enabled) - m.Save("Next", &x.Next) - m.Save("Period", &x.Period) + m.Save(0, &x.Enabled) + m.Save(1, &x.Next) + m.Save(2, &x.Period) } func (x *Setting) afterLoad() {} -func (x *Setting) load(m state.Map) { - m.Load("Enabled", &x.Enabled) - m.Load("Next", &x.Next) - m.Load("Period", &x.Period) + +func (x *Setting) StateLoad(m state.Source) { + m.Load(0, &x.Enabled) + m.Load(1, &x.Next) + m.Load(2, &x.Period) +} + +func (x *Timer) StateTypeName() string { + return "pkg/sentry/kernel/time.Timer" +} + +func (x *Timer) StateFields() []string { + return []string{ + "clock", + "listener", + "setting", + "paused", + } } func (x *Timer) beforeSave() {} -func (x *Timer) save(m state.Map) { + +func (x *Timer) StateSave(m state.Sink) { x.beforeSave() - m.Save("clock", &x.clock) - m.Save("listener", &x.listener) - m.Save("setting", &x.setting) - m.Save("paused", &x.paused) + m.Save(0, &x.clock) + m.Save(1, &x.listener) + m.Save(2, &x.setting) + m.Save(3, &x.paused) } func (x *Timer) afterLoad() {} -func (x *Timer) load(m state.Map) { - m.Load("clock", &x.clock) - m.Load("listener", &x.listener) - m.Load("setting", &x.setting) - m.Load("paused", &x.paused) + +func (x *Timer) StateLoad(m state.Source) { + m.Load(0, &x.clock) + m.Load(1, &x.listener) + m.Load(2, &x.setting) + m.Load(3, &x.paused) } func init() { - state.Register("pkg/sentry/kernel/time.Time", (*Time)(nil), state.Fns{Save: (*Time).save, Load: (*Time).load}) - state.Register("pkg/sentry/kernel/time.Setting", (*Setting)(nil), state.Fns{Save: (*Setting).save, Load: (*Setting).load}) - state.Register("pkg/sentry/kernel/time.Timer", (*Timer)(nil), state.Fns{Save: (*Timer).save, Load: (*Timer).load}) + state.Register((*Time)(nil)) + state.Register((*Setting)(nil)) + state.Register((*Timer)(nil)) } diff --git a/pkg/sentry/limits/limits_state_autogen.go b/pkg/sentry/limits/limits_state_autogen.go index aa42533a9..72503d1d7 100644 --- a/pkg/sentry/limits/limits_state_autogen.go +++ b/pkg/sentry/limits/limits_state_autogen.go @@ -6,31 +6,56 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Limit) StateTypeName() string { + return "pkg/sentry/limits.Limit" +} + +func (x *Limit) StateFields() []string { + return []string{ + "Cur", + "Max", + } +} + func (x *Limit) beforeSave() {} -func (x *Limit) save(m state.Map) { + +func (x *Limit) StateSave(m state.Sink) { x.beforeSave() - m.Save("Cur", &x.Cur) - m.Save("Max", &x.Max) + m.Save(0, &x.Cur) + m.Save(1, &x.Max) } func (x *Limit) afterLoad() {} -func (x *Limit) load(m state.Map) { - m.Load("Cur", &x.Cur) - m.Load("Max", &x.Max) + +func (x *Limit) StateLoad(m state.Source) { + m.Load(0, &x.Cur) + m.Load(1, &x.Max) +} + +func (x *LimitSet) StateTypeName() string { + return "pkg/sentry/limits.LimitSet" +} + +func (x *LimitSet) StateFields() []string { + return []string{ + "data", + } } func (x *LimitSet) beforeSave() {} -func (x *LimitSet) save(m state.Map) { + +func (x *LimitSet) StateSave(m state.Sink) { x.beforeSave() - m.Save("data", &x.data) + m.Save(0, &x.data) } func (x *LimitSet) afterLoad() {} -func (x *LimitSet) load(m state.Map) { - m.Load("data", &x.data) + +func (x *LimitSet) StateLoad(m state.Source) { + m.Load(0, &x.data) } func init() { - state.Register("pkg/sentry/limits.Limit", (*Limit)(nil), state.Fns{Save: (*Limit).save, Load: (*Limit).load}) - state.Register("pkg/sentry/limits.LimitSet", (*LimitSet)(nil), state.Fns{Save: (*LimitSet).save, Load: (*LimitSet).load}) + state.Register((*Limit)(nil)) + state.Register((*LimitSet)(nil)) } diff --git a/pkg/sentry/loader/loader_state_autogen.go b/pkg/sentry/loader/loader_state_autogen.go index e28667944..1b306bc6a 100644 --- a/pkg/sentry/loader/loader_state_autogen.go +++ b/pkg/sentry/loader/loader_state_autogen.go @@ -6,52 +6,87 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *VDSO) StateTypeName() string { + return "pkg/sentry/loader.VDSO" +} + +func (x *VDSO) StateFields() []string { + return []string{ + "ParamPage", + "vdso", + "os", + "arch", + "phdrs", + } +} + func (x *VDSO) beforeSave() {} -func (x *VDSO) save(m state.Map) { + +func (x *VDSO) StateSave(m state.Sink) { x.beforeSave() var phdrs []elfProgHeader = x.savePhdrs() - m.SaveValue("phdrs", phdrs) - m.Save("ParamPage", &x.ParamPage) - m.Save("vdso", &x.vdso) - m.Save("os", &x.os) - m.Save("arch", &x.arch) + m.SaveValue(4, phdrs) + m.Save(0, &x.ParamPage) + m.Save(1, &x.vdso) + m.Save(2, &x.os) + m.Save(3, &x.arch) } func (x *VDSO) afterLoad() {} -func (x *VDSO) load(m state.Map) { - m.Load("ParamPage", &x.ParamPage) - m.Load("vdso", &x.vdso) - m.Load("os", &x.os) - m.Load("arch", &x.arch) - m.LoadValue("phdrs", new([]elfProgHeader), func(y interface{}) { x.loadPhdrs(y.([]elfProgHeader)) }) + +func (x *VDSO) StateLoad(m state.Source) { + m.Load(0, &x.ParamPage) + m.Load(1, &x.vdso) + m.Load(2, &x.os) + m.Load(3, &x.arch) + m.LoadValue(4, new([]elfProgHeader), func(y interface{}) { x.loadPhdrs(y.([]elfProgHeader)) }) +} + +func (x *elfProgHeader) StateTypeName() string { + return "pkg/sentry/loader.elfProgHeader" +} + +func (x *elfProgHeader) StateFields() []string { + return []string{ + "Type", + "Flags", + "Off", + "Vaddr", + "Paddr", + "Filesz", + "Memsz", + "Align", + } } func (x *elfProgHeader) beforeSave() {} -func (x *elfProgHeader) save(m state.Map) { + +func (x *elfProgHeader) StateSave(m state.Sink) { x.beforeSave() - m.Save("Type", &x.Type) - m.Save("Flags", &x.Flags) - m.Save("Off", &x.Off) - m.Save("Vaddr", &x.Vaddr) - m.Save("Paddr", &x.Paddr) - m.Save("Filesz", &x.Filesz) - m.Save("Memsz", &x.Memsz) - m.Save("Align", &x.Align) + m.Save(0, &x.Type) + m.Save(1, &x.Flags) + m.Save(2, &x.Off) + m.Save(3, &x.Vaddr) + m.Save(4, &x.Paddr) + m.Save(5, &x.Filesz) + m.Save(6, &x.Memsz) + m.Save(7, &x.Align) } func (x *elfProgHeader) afterLoad() {} -func (x *elfProgHeader) load(m state.Map) { - m.Load("Type", &x.Type) - m.Load("Flags", &x.Flags) - m.Load("Off", &x.Off) - m.Load("Vaddr", &x.Vaddr) - m.Load("Paddr", &x.Paddr) - m.Load("Filesz", &x.Filesz) - m.Load("Memsz", &x.Memsz) - m.Load("Align", &x.Align) + +func (x *elfProgHeader) StateLoad(m state.Source) { + m.Load(0, &x.Type) + m.Load(1, &x.Flags) + m.Load(2, &x.Off) + m.Load(3, &x.Vaddr) + m.Load(4, &x.Paddr) + m.Load(5, &x.Filesz) + m.Load(6, &x.Memsz) + m.Load(7, &x.Align) } func init() { - state.Register("pkg/sentry/loader.VDSO", (*VDSO)(nil), state.Fns{Save: (*VDSO).save, Load: (*VDSO).load}) - state.Register("pkg/sentry/loader.elfProgHeader", (*elfProgHeader)(nil), state.Fns{Save: (*elfProgHeader).save, Load: (*elfProgHeader).load}) + state.Register((*VDSO)(nil)) + state.Register((*elfProgHeader)(nil)) } diff --git a/pkg/sentry/memmap/memmap_impl_state_autogen.go b/pkg/sentry/memmap/memmap_impl_state_autogen.go index b66b03884..ed4ab58cb 100644 --- a/pkg/sentry/memmap/memmap_impl_state_autogen.go +++ b/pkg/sentry/memmap/memmap_impl_state_autogen.go @@ -6,60 +6,105 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *MappingSet) StateTypeName() string { + return "pkg/sentry/memmap.MappingSet" +} + +func (x *MappingSet) StateFields() []string { + return []string{ + "root", + } +} + func (x *MappingSet) beforeSave() {} -func (x *MappingSet) save(m state.Map) { + +func (x *MappingSet) StateSave(m state.Sink) { x.beforeSave() var root *MappingSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, 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 *MappingSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*MappingSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*MappingSegmentDataSlices)) }) +} + +func (x *Mappingnode) StateTypeName() string { + return "pkg/sentry/memmap.Mappingnode" +} + +func (x *Mappingnode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *Mappingnode) beforeSave() {} -func (x *Mappingnode) save(m state.Map) { + +func (x *Mappingnode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *Mappingnode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *MappingSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/memmap.MappingSegmentDataSlices" +} + +func (x *MappingSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *MappingSegmentDataSlices) beforeSave() {} -func (x *MappingSegmentDataSlices) save(m state.Map) { + +func (x *MappingSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &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 (x *MappingSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) } func init() { - state.Register("pkg/sentry/memmap.MappingSet", (*MappingSet)(nil), state.Fns{Save: (*MappingSet).save, Load: (*MappingSet).load}) - state.Register("pkg/sentry/memmap.Mappingnode", (*Mappingnode)(nil), state.Fns{Save: (*Mappingnode).save, Load: (*Mappingnode).load}) - state.Register("pkg/sentry/memmap.MappingSegmentDataSlices", (*MappingSegmentDataSlices)(nil), state.Fns{Save: (*MappingSegmentDataSlices).save, Load: (*MappingSegmentDataSlices).load}) + state.Register((*MappingSet)(nil)) + state.Register((*Mappingnode)(nil)) + state.Register((*MappingSegmentDataSlices)(nil)) } diff --git a/pkg/sentry/memmap/memmap_state_autogen.go b/pkg/sentry/memmap/memmap_state_autogen.go index 2072dbad2..d7cd50786 100644 --- a/pkg/sentry/memmap/memmap_state_autogen.go +++ b/pkg/sentry/memmap/memmap_state_autogen.go @@ -6,35 +6,62 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *MappableRange) StateTypeName() string { + return "pkg/sentry/memmap.MappableRange" +} + +func (x *MappableRange) StateFields() []string { + return []string{ + "Start", + "End", + } +} + func (x *MappableRange) beforeSave() {} -func (x *MappableRange) save(m state.Map) { + +func (x *MappableRange) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) + m.Save(0, &x.Start) + m.Save(1, &x.End) } func (x *MappableRange) afterLoad() {} -func (x *MappableRange) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) + +func (x *MappableRange) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) +} + +func (x *MappingOfRange) StateTypeName() string { + return "pkg/sentry/memmap.MappingOfRange" +} + +func (x *MappingOfRange) StateFields() []string { + return []string{ + "MappingSpace", + "AddrRange", + "Writable", + } } func (x *MappingOfRange) beforeSave() {} -func (x *MappingOfRange) save(m state.Map) { + +func (x *MappingOfRange) StateSave(m state.Sink) { x.beforeSave() - m.Save("MappingSpace", &x.MappingSpace) - m.Save("AddrRange", &x.AddrRange) - m.Save("Writable", &x.Writable) + m.Save(0, &x.MappingSpace) + m.Save(1, &x.AddrRange) + m.Save(2, &x.Writable) } func (x *MappingOfRange) afterLoad() {} -func (x *MappingOfRange) load(m state.Map) { - m.Load("MappingSpace", &x.MappingSpace) - m.Load("AddrRange", &x.AddrRange) - m.Load("Writable", &x.Writable) + +func (x *MappingOfRange) StateLoad(m state.Source) { + m.Load(0, &x.MappingSpace) + m.Load(1, &x.AddrRange) + m.Load(2, &x.Writable) } func init() { - state.Register("pkg/sentry/memmap.MappableRange", (*MappableRange)(nil), state.Fns{Save: (*MappableRange).save, Load: (*MappableRange).load}) - state.Register("pkg/sentry/memmap.MappingOfRange", (*MappingOfRange)(nil), state.Fns{Save: (*MappingOfRange).save, Load: (*MappingOfRange).load}) + state.Register((*MappableRange)(nil)) + state.Register((*MappingOfRange)(nil)) } diff --git a/pkg/sentry/mm/io_list.go b/pkg/sentry/mm/io_list.go index ae0f19fc5..7cb6a98ad 100644 --- a/pkg/sentry/mm/io_list.go +++ b/pkg/sentry/mm/io_list.go @@ -56,7 +56,7 @@ func (l *ioList) Back() *ioResult { // // NOTE: This is an O(n) operation. func (l *ioList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (ioElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *ioList) Remove(e *ioResult) { if prev != nil { ioElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { ioElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/mm/mm_state_autogen.go b/pkg/sentry/mm/mm_state_autogen.go index fde35bcd8..2f81a8240 100644 --- a/pkg/sentry/mm/mm_state_autogen.go +++ b/pkg/sentry/mm/mm_state_autogen.go @@ -6,399 +6,707 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *aioManager) StateTypeName() string { + return "pkg/sentry/mm.aioManager" +} + +func (x *aioManager) StateFields() []string { + return []string{ + "contexts", + } +} + func (x *aioManager) beforeSave() {} -func (x *aioManager) save(m state.Map) { + +func (x *aioManager) StateSave(m state.Sink) { x.beforeSave() - m.Save("contexts", &x.contexts) + m.Save(0, &x.contexts) } func (x *aioManager) afterLoad() {} -func (x *aioManager) load(m state.Map) { - m.Load("contexts", &x.contexts) + +func (x *aioManager) StateLoad(m state.Source) { + m.Load(0, &x.contexts) +} + +func (x *ioResult) StateTypeName() string { + return "pkg/sentry/mm.ioResult" +} + +func (x *ioResult) StateFields() []string { + return []string{ + "data", + "ioEntry", + } } func (x *ioResult) beforeSave() {} -func (x *ioResult) save(m state.Map) { + +func (x *ioResult) StateSave(m state.Sink) { x.beforeSave() - m.Save("data", &x.data) - m.Save("ioEntry", &x.ioEntry) + m.Save(0, &x.data) + m.Save(1, &x.ioEntry) } func (x *ioResult) afterLoad() {} -func (x *ioResult) load(m state.Map) { - m.Load("data", &x.data) - m.Load("ioEntry", &x.ioEntry) + +func (x *ioResult) StateLoad(m state.Source) { + m.Load(0, &x.data) + m.Load(1, &x.ioEntry) +} + +func (x *AIOContext) StateTypeName() string { + return "pkg/sentry/mm.AIOContext" +} + +func (x *AIOContext) StateFields() []string { + return []string{ + "results", + "maxOutstanding", + "outstanding", + } } func (x *AIOContext) beforeSave() {} -func (x *AIOContext) save(m state.Map) { + +func (x *AIOContext) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.dead) { - m.Failf("dead is %#v, expected zero", &x.dead) + state.Failf("dead is %#v, expected zero", &x.dead) } - m.Save("results", &x.results) - m.Save("maxOutstanding", &x.maxOutstanding) - m.Save("outstanding", &x.outstanding) + m.Save(0, &x.results) + m.Save(1, &x.maxOutstanding) + m.Save(2, &x.outstanding) } -func (x *AIOContext) load(m state.Map) { - m.Load("results", &x.results) - m.Load("maxOutstanding", &x.maxOutstanding) - m.Load("outstanding", &x.outstanding) +func (x *AIOContext) StateLoad(m state.Source) { + m.Load(0, &x.results) + m.Load(1, &x.maxOutstanding) + m.Load(2, &x.outstanding) m.AfterLoad(x.afterLoad) } +func (x *aioMappable) StateTypeName() string { + return "pkg/sentry/mm.aioMappable" +} + +func (x *aioMappable) StateFields() []string { + return []string{ + "AtomicRefCount", + "mfp", + "fr", + } +} + func (x *aioMappable) beforeSave() {} -func (x *aioMappable) save(m state.Map) { + +func (x *aioMappable) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("mfp", &x.mfp) - m.Save("fr", &x.fr) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.mfp) + m.Save(2, &x.fr) } func (x *aioMappable) afterLoad() {} -func (x *aioMappable) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("mfp", &x.mfp) - m.Load("fr", &x.fr) + +func (x *aioMappable) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.mfp) + m.Load(2, &x.fr) +} + +func (x *fileRefcountSet) StateTypeName() string { + return "pkg/sentry/mm.fileRefcountSet" +} + +func (x *fileRefcountSet) StateFields() []string { + return []string{ + "root", + } } func (x *fileRefcountSet) beforeSave() {} -func (x *fileRefcountSet) save(m state.Map) { + +func (x *fileRefcountSet) StateSave(m state.Sink) { x.beforeSave() var root *fileRefcountSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *fileRefcountSet) afterLoad() {} -func (x *fileRefcountSet) load(m state.Map) { - m.LoadValue("root", new(*fileRefcountSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*fileRefcountSegmentDataSlices)) }) + +func (x *fileRefcountSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*fileRefcountSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*fileRefcountSegmentDataSlices)) }) +} + +func (x *fileRefcountnode) StateTypeName() string { + return "pkg/sentry/mm.fileRefcountnode" +} + +func (x *fileRefcountnode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *fileRefcountnode) beforeSave() {} -func (x *fileRefcountnode) save(m state.Map) { + +func (x *fileRefcountnode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &x.children) } func (x *fileRefcountnode) afterLoad() {} -func (x *fileRefcountnode) 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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *fileRefcountnode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *fileRefcountSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/mm.fileRefcountSegmentDataSlices" +} + +func (x *fileRefcountSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *fileRefcountSegmentDataSlices) beforeSave() {} -func (x *fileRefcountSegmentDataSlices) save(m state.Map) { + +func (x *fileRefcountSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *fileRefcountSegmentDataSlices) afterLoad() {} -func (x *fileRefcountSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *fileRefcountSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *ioList) StateTypeName() string { + return "pkg/sentry/mm.ioList" +} + +func (x *ioList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *ioList) beforeSave() {} -func (x *ioList) save(m state.Map) { + +func (x *ioList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *ioList) afterLoad() {} -func (x *ioList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *ioList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *ioEntry) StateTypeName() string { + return "pkg/sentry/mm.ioEntry" +} + +func (x *ioEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *ioEntry) beforeSave() {} -func (x *ioEntry) save(m state.Map) { + +func (x *ioEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *ioEntry) afterLoad() {} -func (x *ioEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *ioEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *MemoryManager) StateTypeName() string { + return "pkg/sentry/mm.MemoryManager" +} + +func (x *MemoryManager) StateFields() []string { + return []string{ + "p", + "mfp", + "layout", + "privateRefs", + "users", + "vmas", + "brk", + "usageAS", + "lockedAS", + "dataAS", + "defMLockMode", + "pmas", + "curRSS", + "maxRSS", + "argv", + "envv", + "auxv", + "executable", + "dumpability", + "aioManager", + "sleepForActivation", + "vdsoSigReturnAddr", + } } -func (x *MemoryManager) save(m state.Map) { +func (x *MemoryManager) StateSave(m state.Sink) { x.beforeSave() if !state.IsZeroValue(&x.active) { - m.Failf("active is %#v, expected zero", &x.active) + state.Failf("active is %#v, expected zero", &x.active) } if !state.IsZeroValue(&x.captureInvalidations) { - m.Failf("captureInvalidations is %#v, expected zero", &x.captureInvalidations) + state.Failf("captureInvalidations is %#v, expected zero", &x.captureInvalidations) } - m.Save("p", &x.p) - m.Save("mfp", &x.mfp) - m.Save("layout", &x.layout) - m.Save("privateRefs", &x.privateRefs) - m.Save("users", &x.users) - m.Save("vmas", &x.vmas) - m.Save("brk", &x.brk) - m.Save("usageAS", &x.usageAS) - m.Save("lockedAS", &x.lockedAS) - m.Save("dataAS", &x.dataAS) - m.Save("defMLockMode", &x.defMLockMode) - m.Save("pmas", &x.pmas) - m.Save("curRSS", &x.curRSS) - m.Save("maxRSS", &x.maxRSS) - m.Save("argv", &x.argv) - m.Save("envv", &x.envv) - m.Save("auxv", &x.auxv) - m.Save("executable", &x.executable) - m.Save("dumpability", &x.dumpability) - m.Save("aioManager", &x.aioManager) - m.Save("sleepForActivation", &x.sleepForActivation) - m.Save("vdsoSigReturnAddr", &x.vdsoSigReturnAddr) -} - -func (x *MemoryManager) load(m state.Map) { - m.Load("p", &x.p) - m.Load("mfp", &x.mfp) - m.Load("layout", &x.layout) - m.Load("privateRefs", &x.privateRefs) - m.Load("users", &x.users) - m.Load("vmas", &x.vmas) - m.Load("brk", &x.brk) - m.Load("usageAS", &x.usageAS) - m.Load("lockedAS", &x.lockedAS) - m.Load("dataAS", &x.dataAS) - m.Load("defMLockMode", &x.defMLockMode) - m.Load("pmas", &x.pmas) - m.Load("curRSS", &x.curRSS) - m.Load("maxRSS", &x.maxRSS) - m.Load("argv", &x.argv) - m.Load("envv", &x.envv) - m.Load("auxv", &x.auxv) - m.Load("executable", &x.executable) - m.Load("dumpability", &x.dumpability) - m.Load("aioManager", &x.aioManager) - m.Load("sleepForActivation", &x.sleepForActivation) - m.Load("vdsoSigReturnAddr", &x.vdsoSigReturnAddr) + m.Save(0, &x.p) + m.Save(1, &x.mfp) + m.Save(2, &x.layout) + m.Save(3, &x.privateRefs) + m.Save(4, &x.users) + m.Save(5, &x.vmas) + m.Save(6, &x.brk) + m.Save(7, &x.usageAS) + m.Save(8, &x.lockedAS) + m.Save(9, &x.dataAS) + m.Save(10, &x.defMLockMode) + m.Save(11, &x.pmas) + m.Save(12, &x.curRSS) + m.Save(13, &x.maxRSS) + m.Save(14, &x.argv) + m.Save(15, &x.envv) + m.Save(16, &x.auxv) + m.Save(17, &x.executable) + m.Save(18, &x.dumpability) + m.Save(19, &x.aioManager) + m.Save(20, &x.sleepForActivation) + m.Save(21, &x.vdsoSigReturnAddr) +} + +func (x *MemoryManager) StateLoad(m state.Source) { + m.Load(0, &x.p) + m.Load(1, &x.mfp) + m.Load(2, &x.layout) + m.Load(3, &x.privateRefs) + m.Load(4, &x.users) + m.Load(5, &x.vmas) + m.Load(6, &x.brk) + m.Load(7, &x.usageAS) + m.Load(8, &x.lockedAS) + m.Load(9, &x.dataAS) + m.Load(10, &x.defMLockMode) + m.Load(11, &x.pmas) + m.Load(12, &x.curRSS) + m.Load(13, &x.maxRSS) + m.Load(14, &x.argv) + m.Load(15, &x.envv) + m.Load(16, &x.auxv) + m.Load(17, &x.executable) + m.Load(18, &x.dumpability) + m.Load(19, &x.aioManager) + m.Load(20, &x.sleepForActivation) + m.Load(21, &x.vdsoSigReturnAddr) m.AfterLoad(x.afterLoad) } +func (x *vma) StateTypeName() string { + return "pkg/sentry/mm.vma" +} + +func (x *vma) StateFields() []string { + return []string{ + "mappable", + "off", + "realPerms", + "dontfork", + "mlockMode", + "numaPolicy", + "numaNodemask", + "id", + "hint", + } +} + func (x *vma) beforeSave() {} -func (x *vma) save(m state.Map) { + +func (x *vma) StateSave(m state.Sink) { x.beforeSave() var realPerms int = x.saveRealPerms() - m.SaveValue("realPerms", realPerms) - m.Save("mappable", &x.mappable) - m.Save("off", &x.off) - m.Save("dontfork", &x.dontfork) - m.Save("mlockMode", &x.mlockMode) - m.Save("numaPolicy", &x.numaPolicy) - m.Save("numaNodemask", &x.numaNodemask) - m.Save("id", &x.id) - m.Save("hint", &x.hint) + m.SaveValue(2, realPerms) + m.Save(0, &x.mappable) + m.Save(1, &x.off) + m.Save(3, &x.dontfork) + m.Save(4, &x.mlockMode) + m.Save(5, &x.numaPolicy) + m.Save(6, &x.numaNodemask) + m.Save(7, &x.id) + m.Save(8, &x.hint) } func (x *vma) afterLoad() {} -func (x *vma) load(m state.Map) { - m.Load("mappable", &x.mappable) - m.Load("off", &x.off) - m.Load("dontfork", &x.dontfork) - m.Load("mlockMode", &x.mlockMode) - m.Load("numaPolicy", &x.numaPolicy) - m.Load("numaNodemask", &x.numaNodemask) - m.Load("id", &x.id) - m.Load("hint", &x.hint) - m.LoadValue("realPerms", new(int), func(y interface{}) { x.loadRealPerms(y.(int)) }) + +func (x *vma) StateLoad(m state.Source) { + m.Load(0, &x.mappable) + m.Load(1, &x.off) + m.Load(3, &x.dontfork) + m.Load(4, &x.mlockMode) + m.Load(5, &x.numaPolicy) + m.Load(6, &x.numaNodemask) + m.Load(7, &x.id) + m.Load(8, &x.hint) + m.LoadValue(2, new(int), func(y interface{}) { x.loadRealPerms(y.(int)) }) +} + +func (x *pma) StateTypeName() string { + return "pkg/sentry/mm.pma" +} + +func (x *pma) StateFields() []string { + return []string{ + "off", + "translatePerms", + "effectivePerms", + "maxPerms", + "needCOW", + "private", + } } func (x *pma) beforeSave() {} -func (x *pma) save(m state.Map) { + +func (x *pma) StateSave(m state.Sink) { x.beforeSave() - m.Save("off", &x.off) - m.Save("translatePerms", &x.translatePerms) - m.Save("effectivePerms", &x.effectivePerms) - m.Save("maxPerms", &x.maxPerms) - m.Save("needCOW", &x.needCOW) - m.Save("private", &x.private) + m.Save(0, &x.off) + m.Save(1, &x.translatePerms) + m.Save(2, &x.effectivePerms) + m.Save(3, &x.maxPerms) + m.Save(4, &x.needCOW) + m.Save(5, &x.private) } func (x *pma) afterLoad() {} -func (x *pma) load(m state.Map) { - m.Load("off", &x.off) - m.Load("translatePerms", &x.translatePerms) - m.Load("effectivePerms", &x.effectivePerms) - m.Load("maxPerms", &x.maxPerms) - m.Load("needCOW", &x.needCOW) - m.Load("private", &x.private) + +func (x *pma) StateLoad(m state.Source) { + m.Load(0, &x.off) + m.Load(1, &x.translatePerms) + m.Load(2, &x.effectivePerms) + m.Load(3, &x.maxPerms) + m.Load(4, &x.needCOW) + m.Load(5, &x.private) +} + +func (x *privateRefs) StateTypeName() string { + return "pkg/sentry/mm.privateRefs" +} + +func (x *privateRefs) StateFields() []string { + return []string{ + "refs", + } } func (x *privateRefs) beforeSave() {} -func (x *privateRefs) save(m state.Map) { + +func (x *privateRefs) StateSave(m state.Sink) { x.beforeSave() - m.Save("refs", &x.refs) + m.Save(0, &x.refs) } func (x *privateRefs) afterLoad() {} -func (x *privateRefs) load(m state.Map) { - m.Load("refs", &x.refs) + +func (x *privateRefs) StateLoad(m state.Source) { + m.Load(0, &x.refs) +} + +func (x *pmaSet) StateTypeName() string { + return "pkg/sentry/mm.pmaSet" +} + +func (x *pmaSet) StateFields() []string { + return []string{ + "root", + } } func (x *pmaSet) beforeSave() {} -func (x *pmaSet) save(m state.Map) { + +func (x *pmaSet) StateSave(m state.Sink) { x.beforeSave() var root *pmaSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *pmaSet) afterLoad() {} -func (x *pmaSet) load(m state.Map) { - m.LoadValue("root", new(*pmaSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*pmaSegmentDataSlices)) }) + +func (x *pmaSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*pmaSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*pmaSegmentDataSlices)) }) +} + +func (x *pmanode) StateTypeName() string { + return "pkg/sentry/mm.pmanode" +} + +func (x *pmanode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *pmanode) beforeSave() {} -func (x *pmanode) save(m state.Map) { + +func (x *pmanode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &x.children) } func (x *pmanode) afterLoad() {} -func (x *pmanode) 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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *pmanode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *pmaSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/mm.pmaSegmentDataSlices" +} + +func (x *pmaSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *pmaSegmentDataSlices) beforeSave() {} -func (x *pmaSegmentDataSlices) save(m state.Map) { + +func (x *pmaSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *pmaSegmentDataSlices) afterLoad() {} -func (x *pmaSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *pmaSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *SpecialMappable) StateTypeName() string { + return "pkg/sentry/mm.SpecialMappable" +} + +func (x *SpecialMappable) StateFields() []string { + return []string{ + "AtomicRefCount", + "mfp", + "fr", + "name", + } } func (x *SpecialMappable) beforeSave() {} -func (x *SpecialMappable) save(m state.Map) { + +func (x *SpecialMappable) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("mfp", &x.mfp) - m.Save("fr", &x.fr) - m.Save("name", &x.name) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.mfp) + m.Save(2, &x.fr) + m.Save(3, &x.name) } func (x *SpecialMappable) afterLoad() {} -func (x *SpecialMappable) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("mfp", &x.mfp) - m.Load("fr", &x.fr) - m.Load("name", &x.name) + +func (x *SpecialMappable) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.mfp) + m.Load(2, &x.fr) + m.Load(3, &x.name) +} + +func (x *vmaSet) StateTypeName() string { + return "pkg/sentry/mm.vmaSet" +} + +func (x *vmaSet) StateFields() []string { + return []string{ + "root", + } } func (x *vmaSet) beforeSave() {} -func (x *vmaSet) save(m state.Map) { + +func (x *vmaSet) StateSave(m state.Sink) { x.beforeSave() var root *vmaSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *vmaSet) afterLoad() {} -func (x *vmaSet) load(m state.Map) { - m.LoadValue("root", new(*vmaSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*vmaSegmentDataSlices)) }) + +func (x *vmaSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*vmaSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*vmaSegmentDataSlices)) }) +} + +func (x *vmanode) StateTypeName() string { + return "pkg/sentry/mm.vmanode" +} + +func (x *vmanode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *vmanode) beforeSave() {} -func (x *vmanode) save(m state.Map) { + +func (x *vmanode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &x.children) } func (x *vmanode) afterLoad() {} -func (x *vmanode) 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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *vmanode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *vmaSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/mm.vmaSegmentDataSlices" +} + +func (x *vmaSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *vmaSegmentDataSlices) beforeSave() {} -func (x *vmaSegmentDataSlices) save(m state.Map) { + +func (x *vmaSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *vmaSegmentDataSlices) afterLoad() {} -func (x *vmaSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *vmaSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) } func init() { - state.Register("pkg/sentry/mm.aioManager", (*aioManager)(nil), state.Fns{Save: (*aioManager).save, Load: (*aioManager).load}) - state.Register("pkg/sentry/mm.ioResult", (*ioResult)(nil), state.Fns{Save: (*ioResult).save, Load: (*ioResult).load}) - state.Register("pkg/sentry/mm.AIOContext", (*AIOContext)(nil), state.Fns{Save: (*AIOContext).save, Load: (*AIOContext).load}) - state.Register("pkg/sentry/mm.aioMappable", (*aioMappable)(nil), state.Fns{Save: (*aioMappable).save, Load: (*aioMappable).load}) - state.Register("pkg/sentry/mm.fileRefcountSet", (*fileRefcountSet)(nil), state.Fns{Save: (*fileRefcountSet).save, Load: (*fileRefcountSet).load}) - state.Register("pkg/sentry/mm.fileRefcountnode", (*fileRefcountnode)(nil), state.Fns{Save: (*fileRefcountnode).save, Load: (*fileRefcountnode).load}) - state.Register("pkg/sentry/mm.fileRefcountSegmentDataSlices", (*fileRefcountSegmentDataSlices)(nil), state.Fns{Save: (*fileRefcountSegmentDataSlices).save, Load: (*fileRefcountSegmentDataSlices).load}) - state.Register("pkg/sentry/mm.ioList", (*ioList)(nil), state.Fns{Save: (*ioList).save, Load: (*ioList).load}) - state.Register("pkg/sentry/mm.ioEntry", (*ioEntry)(nil), state.Fns{Save: (*ioEntry).save, Load: (*ioEntry).load}) - state.Register("pkg/sentry/mm.MemoryManager", (*MemoryManager)(nil), state.Fns{Save: (*MemoryManager).save, Load: (*MemoryManager).load}) - state.Register("pkg/sentry/mm.vma", (*vma)(nil), state.Fns{Save: (*vma).save, Load: (*vma).load}) - state.Register("pkg/sentry/mm.pma", (*pma)(nil), state.Fns{Save: (*pma).save, Load: (*pma).load}) - state.Register("pkg/sentry/mm.privateRefs", (*privateRefs)(nil), state.Fns{Save: (*privateRefs).save, Load: (*privateRefs).load}) - state.Register("pkg/sentry/mm.pmaSet", (*pmaSet)(nil), state.Fns{Save: (*pmaSet).save, Load: (*pmaSet).load}) - state.Register("pkg/sentry/mm.pmanode", (*pmanode)(nil), state.Fns{Save: (*pmanode).save, Load: (*pmanode).load}) - state.Register("pkg/sentry/mm.pmaSegmentDataSlices", (*pmaSegmentDataSlices)(nil), state.Fns{Save: (*pmaSegmentDataSlices).save, Load: (*pmaSegmentDataSlices).load}) - state.Register("pkg/sentry/mm.SpecialMappable", (*SpecialMappable)(nil), state.Fns{Save: (*SpecialMappable).save, Load: (*SpecialMappable).load}) - state.Register("pkg/sentry/mm.vmaSet", (*vmaSet)(nil), state.Fns{Save: (*vmaSet).save, Load: (*vmaSet).load}) - state.Register("pkg/sentry/mm.vmanode", (*vmanode)(nil), state.Fns{Save: (*vmanode).save, Load: (*vmanode).load}) - state.Register("pkg/sentry/mm.vmaSegmentDataSlices", (*vmaSegmentDataSlices)(nil), state.Fns{Save: (*vmaSegmentDataSlices).save, Load: (*vmaSegmentDataSlices).load}) + state.Register((*aioManager)(nil)) + state.Register((*ioResult)(nil)) + state.Register((*AIOContext)(nil)) + state.Register((*aioMappable)(nil)) + state.Register((*fileRefcountSet)(nil)) + state.Register((*fileRefcountnode)(nil)) + state.Register((*fileRefcountSegmentDataSlices)(nil)) + state.Register((*ioList)(nil)) + state.Register((*ioEntry)(nil)) + state.Register((*MemoryManager)(nil)) + state.Register((*vma)(nil)) + state.Register((*pma)(nil)) + state.Register((*privateRefs)(nil)) + state.Register((*pmaSet)(nil)) + state.Register((*pmanode)(nil)) + state.Register((*pmaSegmentDataSlices)(nil)) + state.Register((*SpecialMappable)(nil)) + state.Register((*vmaSet)(nil)) + state.Register((*vmanode)(nil)) + state.Register((*vmaSegmentDataSlices)(nil)) } diff --git a/pkg/sentry/pgalloc/pgalloc_state_autogen.go b/pkg/sentry/pgalloc/pgalloc_state_autogen.go index e9f37b729..5d2590b33 100644 --- a/pkg/sentry/pgalloc/pgalloc_state_autogen.go +++ b/pkg/sentry/pgalloc/pgalloc_state_autogen.go @@ -6,200 +6,362 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *EvictableRange) StateTypeName() string { + return "pkg/sentry/pgalloc.EvictableRange" +} + +func (x *EvictableRange) StateFields() []string { + return []string{ + "Start", + "End", + } +} + func (x *EvictableRange) beforeSave() {} -func (x *EvictableRange) save(m state.Map) { + +func (x *EvictableRange) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) + m.Save(0, &x.Start) + m.Save(1, &x.End) } func (x *EvictableRange) afterLoad() {} -func (x *EvictableRange) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) + +func (x *EvictableRange) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) +} + +func (x *evictableRangeSet) StateTypeName() string { + return "pkg/sentry/pgalloc.evictableRangeSet" +} + +func (x *evictableRangeSet) StateFields() []string { + return []string{ + "root", + } } func (x *evictableRangeSet) beforeSave() {} -func (x *evictableRangeSet) save(m state.Map) { + +func (x *evictableRangeSet) StateSave(m state.Sink) { x.beforeSave() var root *evictableRangeSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *evictableRangeSet) afterLoad() {} -func (x *evictableRangeSet) load(m state.Map) { - m.LoadValue("root", new(*evictableRangeSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*evictableRangeSegmentDataSlices)) }) + +func (x *evictableRangeSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*evictableRangeSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*evictableRangeSegmentDataSlices)) }) +} + +func (x *evictableRangenode) StateTypeName() string { + return "pkg/sentry/pgalloc.evictableRangenode" +} + +func (x *evictableRangenode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *evictableRangenode) beforeSave() {} -func (x *evictableRangenode) save(m state.Map) { + +func (x *evictableRangenode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &x.children) } func (x *evictableRangenode) afterLoad() {} -func (x *evictableRangenode) 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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *evictableRangenode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *evictableRangeSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/pgalloc.evictableRangeSegmentDataSlices" +} + +func (x *evictableRangeSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *evictableRangeSegmentDataSlices) beforeSave() {} -func (x *evictableRangeSegmentDataSlices) save(m state.Map) { + +func (x *evictableRangeSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *evictableRangeSegmentDataSlices) afterLoad() {} -func (x *evictableRangeSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *evictableRangeSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *usageInfo) StateTypeName() string { + return "pkg/sentry/pgalloc.usageInfo" +} + +func (x *usageInfo) StateFields() []string { + return []string{ + "kind", + "knownCommitted", + "refs", + } } func (x *usageInfo) beforeSave() {} -func (x *usageInfo) save(m state.Map) { + +func (x *usageInfo) StateSave(m state.Sink) { x.beforeSave() - m.Save("kind", &x.kind) - m.Save("knownCommitted", &x.knownCommitted) - m.Save("refs", &x.refs) + m.Save(0, &x.kind) + m.Save(1, &x.knownCommitted) + m.Save(2, &x.refs) } func (x *usageInfo) afterLoad() {} -func (x *usageInfo) load(m state.Map) { - m.Load("kind", &x.kind) - m.Load("knownCommitted", &x.knownCommitted) - m.Load("refs", &x.refs) + +func (x *usageInfo) StateLoad(m state.Source) { + m.Load(0, &x.kind) + m.Load(1, &x.knownCommitted) + m.Load(2, &x.refs) +} + +func (x *reclaimSet) StateTypeName() string { + return "pkg/sentry/pgalloc.reclaimSet" +} + +func (x *reclaimSet) StateFields() []string { + return []string{ + "root", + } } func (x *reclaimSet) beforeSave() {} -func (x *reclaimSet) save(m state.Map) { + +func (x *reclaimSet) StateSave(m state.Sink) { x.beforeSave() var root *reclaimSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *reclaimSet) afterLoad() {} -func (x *reclaimSet) load(m state.Map) { - m.LoadValue("root", new(*reclaimSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*reclaimSegmentDataSlices)) }) + +func (x *reclaimSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*reclaimSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*reclaimSegmentDataSlices)) }) +} + +func (x *reclaimnode) StateTypeName() string { + return "pkg/sentry/pgalloc.reclaimnode" +} + +func (x *reclaimnode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *reclaimnode) beforeSave() {} -func (x *reclaimnode) save(m state.Map) { + +func (x *reclaimnode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &x.children) } func (x *reclaimnode) afterLoad() {} -func (x *reclaimnode) 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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *reclaimnode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *reclaimSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/pgalloc.reclaimSegmentDataSlices" +} + +func (x *reclaimSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *reclaimSegmentDataSlices) beforeSave() {} -func (x *reclaimSegmentDataSlices) save(m state.Map) { + +func (x *reclaimSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *reclaimSegmentDataSlices) afterLoad() {} -func (x *reclaimSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *reclaimSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) +} + +func (x *usageSet) StateTypeName() string { + return "pkg/sentry/pgalloc.usageSet" +} + +func (x *usageSet) StateFields() []string { + return []string{ + "root", + } } func (x *usageSet) beforeSave() {} -func (x *usageSet) save(m state.Map) { + +func (x *usageSet) StateSave(m state.Sink) { x.beforeSave() var root *usageSegmentDataSlices = x.saveRoot() - m.SaveValue("root", root) + m.SaveValue(0, root) } func (x *usageSet) afterLoad() {} -func (x *usageSet) load(m state.Map) { - m.LoadValue("root", new(*usageSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*usageSegmentDataSlices)) }) + +func (x *usageSet) StateLoad(m state.Source) { + m.LoadValue(0, new(*usageSegmentDataSlices), func(y interface{}) { x.loadRoot(y.(*usageSegmentDataSlices)) }) +} + +func (x *usagenode) StateTypeName() string { + return "pkg/sentry/pgalloc.usagenode" +} + +func (x *usagenode) StateFields() []string { + return []string{ + "nrSegments", + "parent", + "parentIndex", + "hasChildren", + "maxGap", + "keys", + "values", + "children", + } } func (x *usagenode) beforeSave() {} -func (x *usagenode) save(m state.Map) { + +func (x *usagenode) StateSave(m state.Sink) { x.beforeSave() - m.Save("nrSegments", &x.nrSegments) - m.Save("parent", &x.parent) - m.Save("parentIndex", &x.parentIndex) - m.Save("hasChildren", &x.hasChildren) - m.Save("maxGap", &x.maxGap) - m.Save("keys", &x.keys) - m.Save("values", &x.values) - m.Save("children", &x.children) + m.Save(0, &x.nrSegments) + m.Save(1, &x.parent) + m.Save(2, &x.parentIndex) + m.Save(3, &x.hasChildren) + m.Save(4, &x.maxGap) + m.Save(5, &x.keys) + m.Save(6, &x.values) + m.Save(7, &x.children) } func (x *usagenode) afterLoad() {} -func (x *usagenode) 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("maxGap", &x.maxGap) - m.Load("keys", &x.keys) - m.Load("values", &x.values) - m.Load("children", &x.children) + +func (x *usagenode) StateLoad(m state.Source) { + m.Load(0, &x.nrSegments) + m.Load(1, &x.parent) + m.Load(2, &x.parentIndex) + m.Load(3, &x.hasChildren) + m.Load(4, &x.maxGap) + m.Load(5, &x.keys) + m.Load(6, &x.values) + m.Load(7, &x.children) +} + +func (x *usageSegmentDataSlices) StateTypeName() string { + return "pkg/sentry/pgalloc.usageSegmentDataSlices" +} + +func (x *usageSegmentDataSlices) StateFields() []string { + return []string{ + "Start", + "End", + "Values", + } } func (x *usageSegmentDataSlices) beforeSave() {} -func (x *usageSegmentDataSlices) save(m state.Map) { + +func (x *usageSegmentDataSlices) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) - m.Save("Values", &x.Values) + m.Save(0, &x.Start) + m.Save(1, &x.End) + m.Save(2, &x.Values) } func (x *usageSegmentDataSlices) afterLoad() {} -func (x *usageSegmentDataSlices) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) - m.Load("Values", &x.Values) + +func (x *usageSegmentDataSlices) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) + m.Load(2, &x.Values) } func init() { - state.Register("pkg/sentry/pgalloc.EvictableRange", (*EvictableRange)(nil), state.Fns{Save: (*EvictableRange).save, Load: (*EvictableRange).load}) - state.Register("pkg/sentry/pgalloc.evictableRangeSet", (*evictableRangeSet)(nil), state.Fns{Save: (*evictableRangeSet).save, Load: (*evictableRangeSet).load}) - state.Register("pkg/sentry/pgalloc.evictableRangenode", (*evictableRangenode)(nil), state.Fns{Save: (*evictableRangenode).save, Load: (*evictableRangenode).load}) - state.Register("pkg/sentry/pgalloc.evictableRangeSegmentDataSlices", (*evictableRangeSegmentDataSlices)(nil), state.Fns{Save: (*evictableRangeSegmentDataSlices).save, Load: (*evictableRangeSegmentDataSlices).load}) - state.Register("pkg/sentry/pgalloc.usageInfo", (*usageInfo)(nil), state.Fns{Save: (*usageInfo).save, Load: (*usageInfo).load}) - state.Register("pkg/sentry/pgalloc.reclaimSet", (*reclaimSet)(nil), state.Fns{Save: (*reclaimSet).save, Load: (*reclaimSet).load}) - state.Register("pkg/sentry/pgalloc.reclaimnode", (*reclaimnode)(nil), state.Fns{Save: (*reclaimnode).save, Load: (*reclaimnode).load}) - state.Register("pkg/sentry/pgalloc.reclaimSegmentDataSlices", (*reclaimSegmentDataSlices)(nil), state.Fns{Save: (*reclaimSegmentDataSlices).save, Load: (*reclaimSegmentDataSlices).load}) - state.Register("pkg/sentry/pgalloc.usageSet", (*usageSet)(nil), state.Fns{Save: (*usageSet).save, Load: (*usageSet).load}) - state.Register("pkg/sentry/pgalloc.usagenode", (*usagenode)(nil), state.Fns{Save: (*usagenode).save, Load: (*usagenode).load}) - state.Register("pkg/sentry/pgalloc.usageSegmentDataSlices", (*usageSegmentDataSlices)(nil), state.Fns{Save: (*usageSegmentDataSlices).save, Load: (*usageSegmentDataSlices).load}) + state.Register((*EvictableRange)(nil)) + state.Register((*evictableRangeSet)(nil)) + state.Register((*evictableRangenode)(nil)) + state.Register((*evictableRangeSegmentDataSlices)(nil)) + state.Register((*usageInfo)(nil)) + state.Register((*reclaimSet)(nil)) + state.Register((*reclaimnode)(nil)) + state.Register((*reclaimSegmentDataSlices)(nil)) + state.Register((*usageSet)(nil)) + state.Register((*usagenode)(nil)) + state.Register((*usageSegmentDataSlices)(nil)) } diff --git a/pkg/sentry/pgalloc/save_restore.go b/pkg/sentry/pgalloc/save_restore.go index f8385c146..78317fa35 100644 --- a/pkg/sentry/pgalloc/save_restore.go +++ b/pkg/sentry/pgalloc/save_restore.go @@ -26,11 +26,12 @@ import ( "gvisor.dev/gvisor/pkg/log" "gvisor.dev/gvisor/pkg/sentry/usage" "gvisor.dev/gvisor/pkg/state" + "gvisor.dev/gvisor/pkg/state/wire" "gvisor.dev/gvisor/pkg/usermem" ) // SaveTo writes f's state to the given stream. -func (f *MemoryFile) SaveTo(ctx context.Context, w io.Writer) error { +func (f *MemoryFile) SaveTo(ctx context.Context, w wire.Writer) error { // Wait for reclaim. f.mu.Lock() defer f.mu.Unlock() @@ -79,10 +80,10 @@ func (f *MemoryFile) SaveTo(ctx context.Context, w io.Writer) error { } // Save metadata. - if err := state.Save(ctx, w, &f.fileSize, nil); err != nil { + if _, err := state.Save(ctx, w, &f.fileSize); err != nil { return err } - if err := state.Save(ctx, w, &f.usage, nil); err != nil { + if _, err := state.Save(ctx, w, &f.usage); err != nil { return err } @@ -115,9 +116,9 @@ func (f *MemoryFile) SaveTo(ctx context.Context, w io.Writer) error { } // LoadFrom loads MemoryFile state from the given stream. -func (f *MemoryFile) LoadFrom(ctx context.Context, r io.Reader) error { +func (f *MemoryFile) LoadFrom(ctx context.Context, r wire.Reader) error { // Load metadata. - if err := state.Load(ctx, r, &f.fileSize, nil); err != nil { + if _, err := state.Load(ctx, r, &f.fileSize); err != nil { return err } if err := f.file.Truncate(f.fileSize); err != nil { @@ -125,7 +126,7 @@ func (f *MemoryFile) LoadFrom(ctx context.Context, r io.Reader) error { } newMappings := make([]uintptr, f.fileSize>>chunkShift) f.mappings.Store(newMappings) - if err := state.Load(ctx, r, &f.usage, nil); err != nil { + if _, err := state.Load(ctx, r, &f.usage); err != nil { return err } diff --git a/pkg/sentry/platform/platform_state_autogen.go b/pkg/sentry/platform/platform_state_autogen.go index 7597195ef..696d2f9f1 100644 --- a/pkg/sentry/platform/platform_state_autogen.go +++ b/pkg/sentry/platform/platform_state_autogen.go @@ -6,19 +6,32 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *FileRange) StateTypeName() string { + return "pkg/sentry/platform.FileRange" +} + +func (x *FileRange) StateFields() []string { + return []string{ + "Start", + "End", + } +} + func (x *FileRange) beforeSave() {} -func (x *FileRange) save(m state.Map) { + +func (x *FileRange) StateSave(m state.Sink) { x.beforeSave() - m.Save("Start", &x.Start) - m.Save("End", &x.End) + m.Save(0, &x.Start) + m.Save(1, &x.End) } func (x *FileRange) afterLoad() {} -func (x *FileRange) load(m state.Map) { - m.Load("Start", &x.Start) - m.Load("End", &x.End) + +func (x *FileRange) StateLoad(m state.Source) { + m.Load(0, &x.Start) + m.Load(1, &x.End) } func init() { - state.Register("pkg/sentry/platform.FileRange", (*FileRange)(nil), state.Fns{Save: (*FileRange).save, Load: (*FileRange).load}) + state.Register((*FileRange)(nil)) } diff --git a/pkg/sentry/socket/control/control_state_autogen.go b/pkg/sentry/socket/control/control_state_autogen.go index 8a37b04c0..f3adf8927 100644 --- a/pkg/sentry/socket/control/control_state_autogen.go +++ b/pkg/sentry/socket/control/control_state_autogen.go @@ -3,34 +3,47 @@ package control import ( - "gvisor.dev/gvisor/pkg/sentry/fs" "gvisor.dev/gvisor/pkg/state" ) -func (x *RightsFiles) save(m state.Map) { - m.SaveValue("", ([]*fs.File)(*x)) +func (x *RightsFiles) StateTypeName() string { + return "pkg/sentry/socket/control.RightsFiles" } -func (x *RightsFiles) load(m state.Map) { - m.LoadValue("", new([]*fs.File), func(y interface{}) { *x = (RightsFiles)(y.([]*fs.File)) }) +func (x *RightsFiles) StateFields() []string { + return nil +} + +func (x *scmCredentials) StateTypeName() string { + return "pkg/sentry/socket/control.scmCredentials" +} + +func (x *scmCredentials) StateFields() []string { + return []string{ + "t", + "kuid", + "kgid", + } } func (x *scmCredentials) beforeSave() {} -func (x *scmCredentials) save(m state.Map) { + +func (x *scmCredentials) StateSave(m state.Sink) { x.beforeSave() - m.Save("t", &x.t) - m.Save("kuid", &x.kuid) - m.Save("kgid", &x.kgid) + m.Save(0, &x.t) + m.Save(1, &x.kuid) + m.Save(2, &x.kgid) } func (x *scmCredentials) afterLoad() {} -func (x *scmCredentials) load(m state.Map) { - m.Load("t", &x.t) - m.Load("kuid", &x.kuid) - m.Load("kgid", &x.kgid) + +func (x *scmCredentials) StateLoad(m state.Source) { + m.Load(0, &x.t) + m.Load(1, &x.kuid) + m.Load(2, &x.kgid) } func init() { - state.Register("pkg/sentry/socket/control.RightsFiles", (*RightsFiles)(nil), state.Fns{Save: (*RightsFiles).save, Load: (*RightsFiles).load}) - state.Register("pkg/sentry/socket/control.scmCredentials", (*scmCredentials)(nil), state.Fns{Save: (*scmCredentials).save, Load: (*scmCredentials).load}) + state.Register((*RightsFiles)(nil)) + state.Register((*scmCredentials)(nil)) } diff --git a/pkg/sentry/socket/hostinet/hostinet_state_autogen.go b/pkg/sentry/socket/hostinet/hostinet_state_autogen.go index 333811074..4ee4df33b 100644 --- a/pkg/sentry/socket/hostinet/hostinet_state_autogen.go +++ b/pkg/sentry/socket/hostinet/hostinet_state_autogen.go @@ -6,27 +6,44 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *socketOpsCommon) StateTypeName() string { + return "pkg/sentry/socket/hostinet.socketOpsCommon" +} + +func (x *socketOpsCommon) StateFields() []string { + return []string{ + "SendReceiveTimeout", + "family", + "stype", + "protocol", + "queue", + "fd", + } +} + func (x *socketOpsCommon) beforeSave() {} -func (x *socketOpsCommon) save(m state.Map) { + +func (x *socketOpsCommon) StateSave(m state.Sink) { x.beforeSave() - m.Save("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Save("family", &x.family) - m.Save("stype", &x.stype) - m.Save("protocol", &x.protocol) - m.Save("queue", &x.queue) - m.Save("fd", &x.fd) + m.Save(0, &x.SendReceiveTimeout) + m.Save(1, &x.family) + m.Save(2, &x.stype) + m.Save(3, &x.protocol) + m.Save(4, &x.queue) + m.Save(5, &x.fd) } func (x *socketOpsCommon) afterLoad() {} -func (x *socketOpsCommon) load(m state.Map) { - m.Load("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Load("family", &x.family) - m.Load("stype", &x.stype) - m.Load("protocol", &x.protocol) - m.Load("queue", &x.queue) - m.Load("fd", &x.fd) + +func (x *socketOpsCommon) StateLoad(m state.Source) { + m.Load(0, &x.SendReceiveTimeout) + m.Load(1, &x.family) + m.Load(2, &x.stype) + m.Load(3, &x.protocol) + m.Load(4, &x.queue) + m.Load(5, &x.fd) } func init() { - state.Register("pkg/sentry/socket/hostinet.socketOpsCommon", (*socketOpsCommon)(nil), state.Fns{Save: (*socketOpsCommon).save, Load: (*socketOpsCommon).load}) + state.Register((*socketOpsCommon)(nil)) } diff --git a/pkg/sentry/socket/netlink/netlink_state_autogen.go b/pkg/sentry/socket/netlink/netlink_state_autogen.go index fa6a7ce74..5a7a09b6d 100644 --- a/pkg/sentry/socket/netlink/netlink_state_autogen.go +++ b/pkg/sentry/socket/netlink/netlink_state_autogen.go @@ -6,59 +6,103 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Socket) StateTypeName() string { + return "pkg/sentry/socket/netlink.Socket" +} + +func (x *Socket) StateFields() []string { + return []string{ + "socketOpsCommon", + } +} + func (x *Socket) beforeSave() {} -func (x *Socket) save(m state.Map) { + +func (x *Socket) StateSave(m state.Sink) { x.beforeSave() - m.Save("socketOpsCommon", &x.socketOpsCommon) + m.Save(0, &x.socketOpsCommon) } func (x *Socket) afterLoad() {} -func (x *Socket) load(m state.Map) { - m.Load("socketOpsCommon", &x.socketOpsCommon) + +func (x *Socket) StateLoad(m state.Source) { + m.Load(0, &x.socketOpsCommon) +} + +func (x *socketOpsCommon) StateTypeName() string { + return "pkg/sentry/socket/netlink.socketOpsCommon" +} + +func (x *socketOpsCommon) StateFields() []string { + return []string{ + "SendReceiveTimeout", + "ports", + "protocol", + "skType", + "ep", + "connection", + "bound", + "portID", + "sendBufferSize", + "passcred", + "filter", + } } func (x *socketOpsCommon) beforeSave() {} -func (x *socketOpsCommon) save(m state.Map) { + +func (x *socketOpsCommon) StateSave(m state.Sink) { x.beforeSave() - m.Save("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Save("ports", &x.ports) - m.Save("protocol", &x.protocol) - m.Save("skType", &x.skType) - m.Save("ep", &x.ep) - m.Save("connection", &x.connection) - m.Save("bound", &x.bound) - m.Save("portID", &x.portID) - m.Save("sendBufferSize", &x.sendBufferSize) - m.Save("passcred", &x.passcred) - m.Save("filter", &x.filter) + m.Save(0, &x.SendReceiveTimeout) + m.Save(1, &x.ports) + m.Save(2, &x.protocol) + m.Save(3, &x.skType) + m.Save(4, &x.ep) + m.Save(5, &x.connection) + m.Save(6, &x.bound) + m.Save(7, &x.portID) + m.Save(8, &x.sendBufferSize) + m.Save(9, &x.passcred) + m.Save(10, &x.filter) } func (x *socketOpsCommon) afterLoad() {} -func (x *socketOpsCommon) load(m state.Map) { - m.Load("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Load("ports", &x.ports) - m.Load("protocol", &x.protocol) - m.Load("skType", &x.skType) - m.Load("ep", &x.ep) - m.Load("connection", &x.connection) - m.Load("bound", &x.bound) - m.Load("portID", &x.portID) - m.Load("sendBufferSize", &x.sendBufferSize) - m.Load("passcred", &x.passcred) - m.Load("filter", &x.filter) + +func (x *socketOpsCommon) StateLoad(m state.Source) { + m.Load(0, &x.SendReceiveTimeout) + m.Load(1, &x.ports) + m.Load(2, &x.protocol) + m.Load(3, &x.skType) + m.Load(4, &x.ep) + m.Load(5, &x.connection) + m.Load(6, &x.bound) + m.Load(7, &x.portID) + m.Load(8, &x.sendBufferSize) + m.Load(9, &x.passcred) + m.Load(10, &x.filter) +} + +func (x *kernelSCM) StateTypeName() string { + return "pkg/sentry/socket/netlink.kernelSCM" +} + +func (x *kernelSCM) StateFields() []string { + return []string{} } func (x *kernelSCM) beforeSave() {} -func (x *kernelSCM) save(m state.Map) { + +func (x *kernelSCM) StateSave(m state.Sink) { x.beforeSave() } func (x *kernelSCM) afterLoad() {} -func (x *kernelSCM) load(m state.Map) { + +func (x *kernelSCM) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/socket/netlink.Socket", (*Socket)(nil), state.Fns{Save: (*Socket).save, Load: (*Socket).load}) - state.Register("pkg/sentry/socket/netlink.socketOpsCommon", (*socketOpsCommon)(nil), state.Fns{Save: (*socketOpsCommon).save, Load: (*socketOpsCommon).load}) - state.Register("pkg/sentry/socket/netlink.kernelSCM", (*kernelSCM)(nil), state.Fns{Save: (*kernelSCM).save, Load: (*kernelSCM).load}) + state.Register((*Socket)(nil)) + state.Register((*socketOpsCommon)(nil)) + state.Register((*kernelSCM)(nil)) } diff --git a/pkg/sentry/socket/netlink/port/port_state_autogen.go b/pkg/sentry/socket/netlink/port/port_state_autogen.go index c509cc7d5..16c59e616 100644 --- a/pkg/sentry/socket/netlink/port/port_state_autogen.go +++ b/pkg/sentry/socket/netlink/port/port_state_autogen.go @@ -6,17 +6,29 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Manager) StateTypeName() string { + return "pkg/sentry/socket/netlink/port.Manager" +} + +func (x *Manager) StateFields() []string { + return []string{ + "ports", + } +} + func (x *Manager) beforeSave() {} -func (x *Manager) save(m state.Map) { + +func (x *Manager) StateSave(m state.Sink) { x.beforeSave() - m.Save("ports", &x.ports) + m.Save(0, &x.ports) } func (x *Manager) afterLoad() {} -func (x *Manager) load(m state.Map) { - m.Load("ports", &x.ports) + +func (x *Manager) StateLoad(m state.Source) { + m.Load(0, &x.ports) } func init() { - state.Register("pkg/sentry/socket/netlink/port.Manager", (*Manager)(nil), state.Fns{Save: (*Manager).save, Load: (*Manager).load}) + state.Register((*Manager)(nil)) } diff --git a/pkg/sentry/socket/netlink/route/route_state_autogen.go b/pkg/sentry/socket/netlink/route/route_state_autogen.go index bd10fe189..bc0111017 100644 --- a/pkg/sentry/socket/netlink/route/route_state_autogen.go +++ b/pkg/sentry/socket/netlink/route/route_state_autogen.go @@ -6,15 +6,25 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Protocol) StateTypeName() string { + return "pkg/sentry/socket/netlink/route.Protocol" +} + +func (x *Protocol) StateFields() []string { + return []string{} +} + func (x *Protocol) beforeSave() {} -func (x *Protocol) save(m state.Map) { + +func (x *Protocol) StateSave(m state.Sink) { x.beforeSave() } func (x *Protocol) afterLoad() {} -func (x *Protocol) load(m state.Map) { + +func (x *Protocol) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/socket/netlink/route.Protocol", (*Protocol)(nil), state.Fns{Save: (*Protocol).save, Load: (*Protocol).load}) + state.Register((*Protocol)(nil)) } diff --git a/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go b/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go index b82dddf32..4f2211ec2 100644 --- a/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go +++ b/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go @@ -6,15 +6,25 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Protocol) StateTypeName() string { + return "pkg/sentry/socket/netlink/uevent.Protocol" +} + +func (x *Protocol) StateFields() []string { + return []string{} +} + func (x *Protocol) beforeSave() {} -func (x *Protocol) save(m state.Map) { + +func (x *Protocol) StateSave(m state.Sink) { x.beforeSave() } func (x *Protocol) afterLoad() {} -func (x *Protocol) load(m state.Map) { + +func (x *Protocol) StateLoad(m state.Source) { } func init() { - state.Register("pkg/sentry/socket/netlink/uevent.Protocol", (*Protocol)(nil), state.Fns{Save: (*Protocol).save, Load: (*Protocol).load}) + state.Register((*Protocol)(nil)) } diff --git a/pkg/sentry/socket/netstack/netstack_state_autogen.go b/pkg/sentry/socket/netstack/netstack_state_autogen.go index a1f61607f..b7cf0b290 100644 --- a/pkg/sentry/socket/netstack/netstack_state_autogen.go +++ b/pkg/sentry/socket/netstack/netstack_state_autogen.go @@ -6,65 +6,111 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SocketOperations) StateTypeName() string { + return "pkg/sentry/socket/netstack.SocketOperations" +} + +func (x *SocketOperations) StateFields() []string { + return []string{ + "socketOpsCommon", + } +} + func (x *SocketOperations) beforeSave() {} -func (x *SocketOperations) save(m state.Map) { + +func (x *SocketOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("socketOpsCommon", &x.socketOpsCommon) + m.Save(0, &x.socketOpsCommon) } func (x *SocketOperations) afterLoad() {} -func (x *SocketOperations) load(m state.Map) { - m.Load("socketOpsCommon", &x.socketOpsCommon) + +func (x *SocketOperations) StateLoad(m state.Source) { + m.Load(0, &x.socketOpsCommon) +} + +func (x *socketOpsCommon) StateTypeName() string { + return "pkg/sentry/socket/netstack.socketOpsCommon" +} + +func (x *socketOpsCommon) StateFields() []string { + return []string{ + "SendReceiveTimeout", + "Queue", + "family", + "Endpoint", + "skType", + "protocol", + "readViewHasData", + "readView", + "readCM", + "sender", + "sockOptTimestamp", + "timestampValid", + "timestampNS", + "sockOptInq", + } } func (x *socketOpsCommon) beforeSave() {} -func (x *socketOpsCommon) save(m state.Map) { + +func (x *socketOpsCommon) StateSave(m state.Sink) { x.beforeSave() - m.Save("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Save("Queue", &x.Queue) - m.Save("family", &x.family) - m.Save("Endpoint", &x.Endpoint) - m.Save("skType", &x.skType) - m.Save("protocol", &x.protocol) - m.Save("readViewHasData", &x.readViewHasData) - m.Save("readView", &x.readView) - m.Save("readCM", &x.readCM) - m.Save("sender", &x.sender) - m.Save("sockOptTimestamp", &x.sockOptTimestamp) - m.Save("timestampValid", &x.timestampValid) - m.Save("timestampNS", &x.timestampNS) - m.Save("sockOptInq", &x.sockOptInq) + m.Save(0, &x.SendReceiveTimeout) + m.Save(1, &x.Queue) + m.Save(2, &x.family) + m.Save(3, &x.Endpoint) + m.Save(4, &x.skType) + m.Save(5, &x.protocol) + m.Save(6, &x.readViewHasData) + m.Save(7, &x.readView) + m.Save(8, &x.readCM) + m.Save(9, &x.sender) + m.Save(10, &x.sockOptTimestamp) + m.Save(11, &x.timestampValid) + m.Save(12, &x.timestampNS) + m.Save(13, &x.sockOptInq) } func (x *socketOpsCommon) afterLoad() {} -func (x *socketOpsCommon) load(m state.Map) { - m.Load("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Load("Queue", &x.Queue) - m.Load("family", &x.family) - m.Load("Endpoint", &x.Endpoint) - m.Load("skType", &x.skType) - m.Load("protocol", &x.protocol) - m.Load("readViewHasData", &x.readViewHasData) - m.Load("readView", &x.readView) - m.Load("readCM", &x.readCM) - m.Load("sender", &x.sender) - m.Load("sockOptTimestamp", &x.sockOptTimestamp) - m.Load("timestampValid", &x.timestampValid) - m.Load("timestampNS", &x.timestampNS) - m.Load("sockOptInq", &x.sockOptInq) + +func (x *socketOpsCommon) StateLoad(m state.Source) { + m.Load(0, &x.SendReceiveTimeout) + m.Load(1, &x.Queue) + m.Load(2, &x.family) + m.Load(3, &x.Endpoint) + m.Load(4, &x.skType) + m.Load(5, &x.protocol) + m.Load(6, &x.readViewHasData) + m.Load(7, &x.readView) + m.Load(8, &x.readCM) + m.Load(9, &x.sender) + m.Load(10, &x.sockOptTimestamp) + m.Load(11, &x.timestampValid) + m.Load(12, &x.timestampNS) + m.Load(13, &x.sockOptInq) +} + +func (x *Stack) StateTypeName() string { + return "pkg/sentry/socket/netstack.Stack" +} + +func (x *Stack) StateFields() []string { + return []string{} } func (x *Stack) beforeSave() {} -func (x *Stack) save(m state.Map) { + +func (x *Stack) StateSave(m state.Sink) { x.beforeSave() } -func (x *Stack) load(m state.Map) { +func (x *Stack) StateLoad(m state.Source) { m.AfterLoad(x.afterLoad) } func init() { - state.Register("pkg/sentry/socket/netstack.SocketOperations", (*SocketOperations)(nil), state.Fns{Save: (*SocketOperations).save, Load: (*SocketOperations).load}) - state.Register("pkg/sentry/socket/netstack.socketOpsCommon", (*socketOpsCommon)(nil), state.Fns{Save: (*socketOpsCommon).save, Load: (*socketOpsCommon).load}) - state.Register("pkg/sentry/socket/netstack.Stack", (*Stack)(nil), state.Fns{Save: (*Stack).save, Load: (*Stack).load}) + state.Register((*SocketOperations)(nil)) + state.Register((*socketOpsCommon)(nil)) + state.Register((*Stack)(nil)) } diff --git a/pkg/sentry/socket/socket_state_autogen.go b/pkg/sentry/socket/socket_state_autogen.go index 900c217c7..2865933e9 100644 --- a/pkg/sentry/socket/socket_state_autogen.go +++ b/pkg/sentry/socket/socket_state_autogen.go @@ -6,19 +6,32 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SendReceiveTimeout) StateTypeName() string { + return "pkg/sentry/socket.SendReceiveTimeout" +} + +func (x *SendReceiveTimeout) StateFields() []string { + return []string{ + "send", + "recv", + } +} + func (x *SendReceiveTimeout) beforeSave() {} -func (x *SendReceiveTimeout) save(m state.Map) { + +func (x *SendReceiveTimeout) StateSave(m state.Sink) { x.beforeSave() - m.Save("send", &x.send) - m.Save("recv", &x.recv) + m.Save(0, &x.send) + m.Save(1, &x.recv) } func (x *SendReceiveTimeout) afterLoad() {} -func (x *SendReceiveTimeout) load(m state.Map) { - m.Load("send", &x.send) - m.Load("recv", &x.recv) + +func (x *SendReceiveTimeout) StateLoad(m state.Source) { + m.Load(0, &x.send) + m.Load(1, &x.recv) } func init() { - state.Register("pkg/sentry/socket.SendReceiveTimeout", (*SendReceiveTimeout)(nil), state.Fns{Save: (*SendReceiveTimeout).save, Load: (*SendReceiveTimeout).load}) + state.Register((*SendReceiveTimeout)(nil)) } diff --git a/pkg/sentry/socket/unix/transport/transport_message_list.go b/pkg/sentry/socket/unix/transport/transport_message_list.go index 568cd5871..dda579c27 100644 --- a/pkg/sentry/socket/unix/transport/transport_message_list.go +++ b/pkg/sentry/socket/unix/transport/transport_message_list.go @@ -56,7 +56,7 @@ func (l *messageList) Back() *message { // // NOTE: This is an O(n) operation. func (l *messageList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (messageElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *messageList) Remove(e *message) { if prev != nil { messageElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { messageElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/socket/unix/transport/transport_state_autogen.go b/pkg/sentry/socket/unix/transport/transport_state_autogen.go index b47951498..4b88ea3ae 100644 --- a/pkg/sentry/socket/unix/transport/transport_state_autogen.go +++ b/pkg/sentry/socket/unix/transport/transport_state_autogen.go @@ -6,188 +6,345 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *connectionedEndpoint) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.connectionedEndpoint" +} + +func (x *connectionedEndpoint) StateFields() []string { + return []string{ + "baseEndpoint", + "id", + "idGenerator", + "stype", + "acceptedChan", + } +} + func (x *connectionedEndpoint) beforeSave() {} -func (x *connectionedEndpoint) save(m state.Map) { + +func (x *connectionedEndpoint) StateSave(m state.Sink) { x.beforeSave() var acceptedChan []*connectionedEndpoint = x.saveAcceptedChan() - m.SaveValue("acceptedChan", acceptedChan) - m.Save("baseEndpoint", &x.baseEndpoint) - m.Save("id", &x.id) - m.Save("idGenerator", &x.idGenerator) - m.Save("stype", &x.stype) + m.SaveValue(4, acceptedChan) + m.Save(0, &x.baseEndpoint) + m.Save(1, &x.id) + m.Save(2, &x.idGenerator) + m.Save(3, &x.stype) } func (x *connectionedEndpoint) afterLoad() {} -func (x *connectionedEndpoint) load(m state.Map) { - m.Load("baseEndpoint", &x.baseEndpoint) - m.Load("id", &x.id) - m.Load("idGenerator", &x.idGenerator) - m.Load("stype", &x.stype) - m.LoadValue("acceptedChan", new([]*connectionedEndpoint), func(y interface{}) { x.loadAcceptedChan(y.([]*connectionedEndpoint)) }) + +func (x *connectionedEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.baseEndpoint) + m.Load(1, &x.id) + m.Load(2, &x.idGenerator) + m.Load(3, &x.stype) + m.LoadValue(4, new([]*connectionedEndpoint), func(y interface{}) { x.loadAcceptedChan(y.([]*connectionedEndpoint)) }) +} + +func (x *connectionlessEndpoint) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.connectionlessEndpoint" +} + +func (x *connectionlessEndpoint) StateFields() []string { + return []string{ + "baseEndpoint", + } } func (x *connectionlessEndpoint) beforeSave() {} -func (x *connectionlessEndpoint) save(m state.Map) { + +func (x *connectionlessEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("baseEndpoint", &x.baseEndpoint) + m.Save(0, &x.baseEndpoint) } func (x *connectionlessEndpoint) afterLoad() {} -func (x *connectionlessEndpoint) load(m state.Map) { - m.Load("baseEndpoint", &x.baseEndpoint) + +func (x *connectionlessEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.baseEndpoint) +} + +func (x *queue) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.queue" +} + +func (x *queue) StateFields() []string { + return []string{ + "AtomicRefCount", + "ReaderQueue", + "WriterQueue", + "closed", + "unread", + "used", + "limit", + "dataList", + } } func (x *queue) beforeSave() {} -func (x *queue) save(m state.Map) { + +func (x *queue) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("ReaderQueue", &x.ReaderQueue) - m.Save("WriterQueue", &x.WriterQueue) - m.Save("closed", &x.closed) - m.Save("unread", &x.unread) - m.Save("used", &x.used) - m.Save("limit", &x.limit) - m.Save("dataList", &x.dataList) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.ReaderQueue) + m.Save(2, &x.WriterQueue) + m.Save(3, &x.closed) + m.Save(4, &x.unread) + m.Save(5, &x.used) + m.Save(6, &x.limit) + m.Save(7, &x.dataList) } func (x *queue) afterLoad() {} -func (x *queue) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("ReaderQueue", &x.ReaderQueue) - m.Load("WriterQueue", &x.WriterQueue) - m.Load("closed", &x.closed) - m.Load("unread", &x.unread) - m.Load("used", &x.used) - m.Load("limit", &x.limit) - m.Load("dataList", &x.dataList) + +func (x *queue) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.ReaderQueue) + m.Load(2, &x.WriterQueue) + m.Load(3, &x.closed) + m.Load(4, &x.unread) + m.Load(5, &x.used) + m.Load(6, &x.limit) + m.Load(7, &x.dataList) +} + +func (x *messageList) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.messageList" +} + +func (x *messageList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *messageList) beforeSave() {} -func (x *messageList) save(m state.Map) { + +func (x *messageList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *messageList) afterLoad() {} -func (x *messageList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *messageList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *messageEntry) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.messageEntry" +} + +func (x *messageEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *messageEntry) beforeSave() {} -func (x *messageEntry) save(m state.Map) { + +func (x *messageEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *messageEntry) afterLoad() {} -func (x *messageEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *messageEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *ControlMessages) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.ControlMessages" +} + +func (x *ControlMessages) StateFields() []string { + return []string{ + "Rights", + "Credentials", + } } func (x *ControlMessages) beforeSave() {} -func (x *ControlMessages) save(m state.Map) { + +func (x *ControlMessages) StateSave(m state.Sink) { x.beforeSave() - m.Save("Rights", &x.Rights) - m.Save("Credentials", &x.Credentials) + m.Save(0, &x.Rights) + m.Save(1, &x.Credentials) } func (x *ControlMessages) afterLoad() {} -func (x *ControlMessages) load(m state.Map) { - m.Load("Rights", &x.Rights) - m.Load("Credentials", &x.Credentials) + +func (x *ControlMessages) StateLoad(m state.Source) { + m.Load(0, &x.Rights) + m.Load(1, &x.Credentials) +} + +func (x *message) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.message" +} + +func (x *message) StateFields() []string { + return []string{ + "messageEntry", + "Data", + "Control", + "Address", + } } func (x *message) beforeSave() {} -func (x *message) save(m state.Map) { + +func (x *message) StateSave(m state.Sink) { x.beforeSave() - m.Save("messageEntry", &x.messageEntry) - m.Save("Data", &x.Data) - m.Save("Control", &x.Control) - m.Save("Address", &x.Address) + m.Save(0, &x.messageEntry) + m.Save(1, &x.Data) + m.Save(2, &x.Control) + m.Save(3, &x.Address) } func (x *message) afterLoad() {} -func (x *message) load(m state.Map) { - m.Load("messageEntry", &x.messageEntry) - m.Load("Data", &x.Data) - m.Load("Control", &x.Control) - m.Load("Address", &x.Address) + +func (x *message) StateLoad(m state.Source) { + m.Load(0, &x.messageEntry) + m.Load(1, &x.Data) + m.Load(2, &x.Control) + m.Load(3, &x.Address) +} + +func (x *queueReceiver) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.queueReceiver" +} + +func (x *queueReceiver) StateFields() []string { + return []string{ + "readQueue", + } } func (x *queueReceiver) beforeSave() {} -func (x *queueReceiver) save(m state.Map) { + +func (x *queueReceiver) StateSave(m state.Sink) { x.beforeSave() - m.Save("readQueue", &x.readQueue) + m.Save(0, &x.readQueue) } func (x *queueReceiver) afterLoad() {} -func (x *queueReceiver) load(m state.Map) { - m.Load("readQueue", &x.readQueue) + +func (x *queueReceiver) StateLoad(m state.Source) { + m.Load(0, &x.readQueue) +} + +func (x *streamQueueReceiver) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.streamQueueReceiver" +} + +func (x *streamQueueReceiver) StateFields() []string { + return []string{ + "queueReceiver", + "buffer", + "control", + "addr", + } } func (x *streamQueueReceiver) beforeSave() {} -func (x *streamQueueReceiver) save(m state.Map) { + +func (x *streamQueueReceiver) StateSave(m state.Sink) { x.beforeSave() - m.Save("queueReceiver", &x.queueReceiver) - m.Save("buffer", &x.buffer) - m.Save("control", &x.control) - m.Save("addr", &x.addr) + m.Save(0, &x.queueReceiver) + m.Save(1, &x.buffer) + m.Save(2, &x.control) + m.Save(3, &x.addr) } func (x *streamQueueReceiver) afterLoad() {} -func (x *streamQueueReceiver) load(m state.Map) { - m.Load("queueReceiver", &x.queueReceiver) - m.Load("buffer", &x.buffer) - m.Load("control", &x.control) - m.Load("addr", &x.addr) + +func (x *streamQueueReceiver) StateLoad(m state.Source) { + m.Load(0, &x.queueReceiver) + m.Load(1, &x.buffer) + m.Load(2, &x.control) + m.Load(3, &x.addr) +} + +func (x *connectedEndpoint) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.connectedEndpoint" +} + +func (x *connectedEndpoint) StateFields() []string { + return []string{ + "endpoint", + "writeQueue", + } } func (x *connectedEndpoint) beforeSave() {} -func (x *connectedEndpoint) save(m state.Map) { + +func (x *connectedEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("endpoint", &x.endpoint) - m.Save("writeQueue", &x.writeQueue) + m.Save(0, &x.endpoint) + m.Save(1, &x.writeQueue) } func (x *connectedEndpoint) afterLoad() {} -func (x *connectedEndpoint) load(m state.Map) { - m.Load("endpoint", &x.endpoint) - m.Load("writeQueue", &x.writeQueue) + +func (x *connectedEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.endpoint) + m.Load(1, &x.writeQueue) +} + +func (x *baseEndpoint) StateTypeName() string { + return "pkg/sentry/socket/unix/transport.baseEndpoint" +} + +func (x *baseEndpoint) StateFields() []string { + return []string{ + "Queue", + "passcred", + "receiver", + "connected", + "path", + } } func (x *baseEndpoint) beforeSave() {} -func (x *baseEndpoint) save(m state.Map) { + +func (x *baseEndpoint) StateSave(m state.Sink) { x.beforeSave() - m.Save("Queue", &x.Queue) - m.Save("passcred", &x.passcred) - m.Save("receiver", &x.receiver) - m.Save("connected", &x.connected) - m.Save("path", &x.path) + m.Save(0, &x.Queue) + m.Save(1, &x.passcred) + m.Save(2, &x.receiver) + m.Save(3, &x.connected) + m.Save(4, &x.path) } func (x *baseEndpoint) afterLoad() {} -func (x *baseEndpoint) load(m state.Map) { - m.Load("Queue", &x.Queue) - m.Load("passcred", &x.passcred) - m.Load("receiver", &x.receiver) - m.Load("connected", &x.connected) - m.Load("path", &x.path) + +func (x *baseEndpoint) StateLoad(m state.Source) { + m.Load(0, &x.Queue) + m.Load(1, &x.passcred) + m.Load(2, &x.receiver) + m.Load(3, &x.connected) + m.Load(4, &x.path) } func init() { - state.Register("pkg/sentry/socket/unix/transport.connectionedEndpoint", (*connectionedEndpoint)(nil), state.Fns{Save: (*connectionedEndpoint).save, Load: (*connectionedEndpoint).load}) - state.Register("pkg/sentry/socket/unix/transport.connectionlessEndpoint", (*connectionlessEndpoint)(nil), state.Fns{Save: (*connectionlessEndpoint).save, Load: (*connectionlessEndpoint).load}) - state.Register("pkg/sentry/socket/unix/transport.queue", (*queue)(nil), state.Fns{Save: (*queue).save, Load: (*queue).load}) - state.Register("pkg/sentry/socket/unix/transport.messageList", (*messageList)(nil), state.Fns{Save: (*messageList).save, Load: (*messageList).load}) - state.Register("pkg/sentry/socket/unix/transport.messageEntry", (*messageEntry)(nil), state.Fns{Save: (*messageEntry).save, Load: (*messageEntry).load}) - state.Register("pkg/sentry/socket/unix/transport.ControlMessages", (*ControlMessages)(nil), state.Fns{Save: (*ControlMessages).save, Load: (*ControlMessages).load}) - state.Register("pkg/sentry/socket/unix/transport.message", (*message)(nil), state.Fns{Save: (*message).save, Load: (*message).load}) - state.Register("pkg/sentry/socket/unix/transport.queueReceiver", (*queueReceiver)(nil), state.Fns{Save: (*queueReceiver).save, Load: (*queueReceiver).load}) - state.Register("pkg/sentry/socket/unix/transport.streamQueueReceiver", (*streamQueueReceiver)(nil), state.Fns{Save: (*streamQueueReceiver).save, Load: (*streamQueueReceiver).load}) - state.Register("pkg/sentry/socket/unix/transport.connectedEndpoint", (*connectedEndpoint)(nil), state.Fns{Save: (*connectedEndpoint).save, Load: (*connectedEndpoint).load}) - state.Register("pkg/sentry/socket/unix/transport.baseEndpoint", (*baseEndpoint)(nil), state.Fns{Save: (*baseEndpoint).save, Load: (*baseEndpoint).load}) + state.Register((*connectionedEndpoint)(nil)) + state.Register((*connectionlessEndpoint)(nil)) + state.Register((*queue)(nil)) + state.Register((*messageList)(nil)) + state.Register((*messageEntry)(nil)) + state.Register((*ControlMessages)(nil)) + state.Register((*message)(nil)) + state.Register((*queueReceiver)(nil)) + state.Register((*streamQueueReceiver)(nil)) + state.Register((*connectedEndpoint)(nil)) + state.Register((*baseEndpoint)(nil)) } diff --git a/pkg/sentry/socket/unix/unix_state_autogen.go b/pkg/sentry/socket/unix/unix_state_autogen.go index aa05e7b99..4a3bbc11b 100644 --- a/pkg/sentry/socket/unix/unix_state_autogen.go +++ b/pkg/sentry/socket/unix/unix_state_autogen.go @@ -6,35 +6,62 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SocketOperations) StateTypeName() string { + return "pkg/sentry/socket/unix.SocketOperations" +} + +func (x *SocketOperations) StateFields() []string { + return []string{ + "socketOpsCommon", + } +} + func (x *SocketOperations) beforeSave() {} -func (x *SocketOperations) save(m state.Map) { + +func (x *SocketOperations) StateSave(m state.Sink) { x.beforeSave() - m.Save("socketOpsCommon", &x.socketOpsCommon) + m.Save(0, &x.socketOpsCommon) } func (x *SocketOperations) afterLoad() {} -func (x *SocketOperations) load(m state.Map) { - m.Load("socketOpsCommon", &x.socketOpsCommon) + +func (x *SocketOperations) StateLoad(m state.Source) { + m.Load(0, &x.socketOpsCommon) +} + +func (x *socketOpsCommon) StateTypeName() string { + return "pkg/sentry/socket/unix.socketOpsCommon" +} + +func (x *socketOpsCommon) StateFields() []string { + return []string{ + "AtomicRefCount", + "SendReceiveTimeout", + "ep", + "stype", + } } func (x *socketOpsCommon) beforeSave() {} -func (x *socketOpsCommon) save(m state.Map) { + +func (x *socketOpsCommon) StateSave(m state.Sink) { x.beforeSave() - m.Save("AtomicRefCount", &x.AtomicRefCount) - m.Save("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Save("ep", &x.ep) - m.Save("stype", &x.stype) + m.Save(0, &x.AtomicRefCount) + m.Save(1, &x.SendReceiveTimeout) + m.Save(2, &x.ep) + m.Save(3, &x.stype) } func (x *socketOpsCommon) afterLoad() {} -func (x *socketOpsCommon) load(m state.Map) { - m.Load("AtomicRefCount", &x.AtomicRefCount) - m.Load("SendReceiveTimeout", &x.SendReceiveTimeout) - m.Load("ep", &x.ep) - m.Load("stype", &x.stype) + +func (x *socketOpsCommon) StateLoad(m state.Source) { + m.Load(0, &x.AtomicRefCount) + m.Load(1, &x.SendReceiveTimeout) + m.Load(2, &x.ep) + m.Load(3, &x.stype) } func init() { - state.Register("pkg/sentry/socket/unix.SocketOperations", (*SocketOperations)(nil), state.Fns{Save: (*SocketOperations).save, Load: (*SocketOperations).load}) - state.Register("pkg/sentry/socket/unix.socketOpsCommon", (*socketOpsCommon)(nil), state.Fns{Save: (*socketOpsCommon).save, Load: (*socketOpsCommon).load}) + state.Register((*SocketOperations)(nil)) + state.Register((*socketOpsCommon)(nil)) } diff --git a/pkg/sentry/syscalls/linux/linux_state_autogen.go b/pkg/sentry/syscalls/linux/linux_state_autogen.go index c76ccd1d5..8d70a3ee6 100644 --- a/pkg/sentry/syscalls/linux/linux_state_autogen.go +++ b/pkg/sentry/syscalls/linux/linux_state_autogen.go @@ -6,57 +6,101 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *futexWaitRestartBlock) StateTypeName() string { + return "pkg/sentry/syscalls/linux.futexWaitRestartBlock" +} + +func (x *futexWaitRestartBlock) StateFields() []string { + return []string{ + "duration", + "addr", + "private", + "val", + "mask", + } +} + func (x *futexWaitRestartBlock) beforeSave() {} -func (x *futexWaitRestartBlock) save(m state.Map) { + +func (x *futexWaitRestartBlock) StateSave(m state.Sink) { x.beforeSave() - m.Save("duration", &x.duration) - m.Save("addr", &x.addr) - m.Save("private", &x.private) - m.Save("val", &x.val) - m.Save("mask", &x.mask) + m.Save(0, &x.duration) + m.Save(1, &x.addr) + m.Save(2, &x.private) + m.Save(3, &x.val) + m.Save(4, &x.mask) } func (x *futexWaitRestartBlock) afterLoad() {} -func (x *futexWaitRestartBlock) load(m state.Map) { - m.Load("duration", &x.duration) - m.Load("addr", &x.addr) - m.Load("private", &x.private) - m.Load("val", &x.val) - m.Load("mask", &x.mask) + +func (x *futexWaitRestartBlock) StateLoad(m state.Source) { + m.Load(0, &x.duration) + m.Load(1, &x.addr) + m.Load(2, &x.private) + m.Load(3, &x.val) + m.Load(4, &x.mask) +} + +func (x *pollRestartBlock) StateTypeName() string { + return "pkg/sentry/syscalls/linux.pollRestartBlock" +} + +func (x *pollRestartBlock) StateFields() []string { + return []string{ + "pfdAddr", + "nfds", + "timeout", + } } func (x *pollRestartBlock) beforeSave() {} -func (x *pollRestartBlock) save(m state.Map) { + +func (x *pollRestartBlock) StateSave(m state.Sink) { x.beforeSave() - m.Save("pfdAddr", &x.pfdAddr) - m.Save("nfds", &x.nfds) - m.Save("timeout", &x.timeout) + m.Save(0, &x.pfdAddr) + m.Save(1, &x.nfds) + m.Save(2, &x.timeout) } func (x *pollRestartBlock) afterLoad() {} -func (x *pollRestartBlock) load(m state.Map) { - m.Load("pfdAddr", &x.pfdAddr) - m.Load("nfds", &x.nfds) - m.Load("timeout", &x.timeout) + +func (x *pollRestartBlock) StateLoad(m state.Source) { + m.Load(0, &x.pfdAddr) + m.Load(1, &x.nfds) + m.Load(2, &x.timeout) +} + +func (x *clockNanosleepRestartBlock) StateTypeName() string { + return "pkg/sentry/syscalls/linux.clockNanosleepRestartBlock" +} + +func (x *clockNanosleepRestartBlock) StateFields() []string { + return []string{ + "c", + "duration", + "rem", + } } func (x *clockNanosleepRestartBlock) beforeSave() {} -func (x *clockNanosleepRestartBlock) save(m state.Map) { + +func (x *clockNanosleepRestartBlock) StateSave(m state.Sink) { x.beforeSave() - m.Save("c", &x.c) - m.Save("duration", &x.duration) - m.Save("rem", &x.rem) + m.Save(0, &x.c) + m.Save(1, &x.duration) + m.Save(2, &x.rem) } func (x *clockNanosleepRestartBlock) afterLoad() {} -func (x *clockNanosleepRestartBlock) load(m state.Map) { - m.Load("c", &x.c) - m.Load("duration", &x.duration) - m.Load("rem", &x.rem) + +func (x *clockNanosleepRestartBlock) StateLoad(m state.Source) { + m.Load(0, &x.c) + m.Load(1, &x.duration) + m.Load(2, &x.rem) } func init() { - state.Register("pkg/sentry/syscalls/linux.futexWaitRestartBlock", (*futexWaitRestartBlock)(nil), state.Fns{Save: (*futexWaitRestartBlock).save, Load: (*futexWaitRestartBlock).load}) - state.Register("pkg/sentry/syscalls/linux.pollRestartBlock", (*pollRestartBlock)(nil), state.Fns{Save: (*pollRestartBlock).save, Load: (*pollRestartBlock).load}) - state.Register("pkg/sentry/syscalls/linux.clockNanosleepRestartBlock", (*clockNanosleepRestartBlock)(nil), state.Fns{Save: (*clockNanosleepRestartBlock).save, Load: (*clockNanosleepRestartBlock).load}) + state.Register((*futexWaitRestartBlock)(nil)) + state.Register((*pollRestartBlock)(nil)) + state.Register((*clockNanosleepRestartBlock)(nil)) } diff --git a/pkg/sentry/syscalls/linux/vfs2/vfs2_state_autogen.go b/pkg/sentry/syscalls/linux/vfs2/vfs2_state_autogen.go index 570100331..031381834 100644 --- a/pkg/sentry/syscalls/linux/vfs2/vfs2_state_autogen.go +++ b/pkg/sentry/syscalls/linux/vfs2/vfs2_state_autogen.go @@ -6,21 +6,35 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *pollRestartBlock) StateTypeName() string { + return "pkg/sentry/syscalls/linux/vfs2.pollRestartBlock" +} + +func (x *pollRestartBlock) StateFields() []string { + return []string{ + "pfdAddr", + "nfds", + "timeout", + } +} + func (x *pollRestartBlock) beforeSave() {} -func (x *pollRestartBlock) save(m state.Map) { + +func (x *pollRestartBlock) StateSave(m state.Sink) { x.beforeSave() - m.Save("pfdAddr", &x.pfdAddr) - m.Save("nfds", &x.nfds) - m.Save("timeout", &x.timeout) + m.Save(0, &x.pfdAddr) + m.Save(1, &x.nfds) + m.Save(2, &x.timeout) } func (x *pollRestartBlock) afterLoad() {} -func (x *pollRestartBlock) load(m state.Map) { - m.Load("pfdAddr", &x.pfdAddr) - m.Load("nfds", &x.nfds) - m.Load("timeout", &x.timeout) + +func (x *pollRestartBlock) StateLoad(m state.Source) { + m.Load(0, &x.pfdAddr) + m.Load(1, &x.nfds) + m.Load(2, &x.timeout) } func init() { - state.Register("pkg/sentry/syscalls/linux/vfs2.pollRestartBlock", (*pollRestartBlock)(nil), state.Fns{Save: (*pollRestartBlock).save, Load: (*pollRestartBlock).load}) + state.Register((*pollRestartBlock)(nil)) } diff --git a/pkg/sentry/usage/usage_state_autogen.go b/pkg/sentry/usage/usage_state_autogen.go index 42979ea25..a117ad216 100644 --- a/pkg/sentry/usage/usage_state_autogen.go +++ b/pkg/sentry/usage/usage_state_autogen.go @@ -6,45 +6,77 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *CPUStats) StateTypeName() string { + return "pkg/sentry/usage.CPUStats" +} + +func (x *CPUStats) StateFields() []string { + return []string{ + "UserTime", + "SysTime", + "VoluntarySwitches", + } +} + func (x *CPUStats) beforeSave() {} -func (x *CPUStats) save(m state.Map) { + +func (x *CPUStats) StateSave(m state.Sink) { x.beforeSave() - m.Save("UserTime", &x.UserTime) - m.Save("SysTime", &x.SysTime) - m.Save("VoluntarySwitches", &x.VoluntarySwitches) + m.Save(0, &x.UserTime) + m.Save(1, &x.SysTime) + m.Save(2, &x.VoluntarySwitches) } func (x *CPUStats) afterLoad() {} -func (x *CPUStats) load(m state.Map) { - m.Load("UserTime", &x.UserTime) - m.Load("SysTime", &x.SysTime) - m.Load("VoluntarySwitches", &x.VoluntarySwitches) + +func (x *CPUStats) StateLoad(m state.Source) { + m.Load(0, &x.UserTime) + m.Load(1, &x.SysTime) + m.Load(2, &x.VoluntarySwitches) +} + +func (x *IO) StateTypeName() string { + return "pkg/sentry/usage.IO" +} + +func (x *IO) StateFields() []string { + return []string{ + "CharsRead", + "CharsWritten", + "ReadSyscalls", + "WriteSyscalls", + "BytesRead", + "BytesWritten", + "BytesWriteCancelled", + } } func (x *IO) beforeSave() {} -func (x *IO) save(m state.Map) { + +func (x *IO) StateSave(m state.Sink) { x.beforeSave() - m.Save("CharsRead", &x.CharsRead) - m.Save("CharsWritten", &x.CharsWritten) - m.Save("ReadSyscalls", &x.ReadSyscalls) - m.Save("WriteSyscalls", &x.WriteSyscalls) - m.Save("BytesRead", &x.BytesRead) - m.Save("BytesWritten", &x.BytesWritten) - m.Save("BytesWriteCancelled", &x.BytesWriteCancelled) + m.Save(0, &x.CharsRead) + m.Save(1, &x.CharsWritten) + m.Save(2, &x.ReadSyscalls) + m.Save(3, &x.WriteSyscalls) + m.Save(4, &x.BytesRead) + m.Save(5, &x.BytesWritten) + m.Save(6, &x.BytesWriteCancelled) } func (x *IO) afterLoad() {} -func (x *IO) load(m state.Map) { - m.Load("CharsRead", &x.CharsRead) - m.Load("CharsWritten", &x.CharsWritten) - m.Load("ReadSyscalls", &x.ReadSyscalls) - m.Load("WriteSyscalls", &x.WriteSyscalls) - m.Load("BytesRead", &x.BytesRead) - m.Load("BytesWritten", &x.BytesWritten) - m.Load("BytesWriteCancelled", &x.BytesWriteCancelled) + +func (x *IO) StateLoad(m state.Source) { + m.Load(0, &x.CharsRead) + m.Load(1, &x.CharsWritten) + m.Load(2, &x.ReadSyscalls) + m.Load(3, &x.WriteSyscalls) + m.Load(4, &x.BytesRead) + m.Load(5, &x.BytesWritten) + m.Load(6, &x.BytesWriteCancelled) } func init() { - state.Register("pkg/sentry/usage.CPUStats", (*CPUStats)(nil), state.Fns{Save: (*CPUStats).save, Load: (*CPUStats).load}) - state.Register("pkg/sentry/usage.IO", (*IO)(nil), state.Fns{Save: (*IO).save, Load: (*IO).load}) + state.Register((*CPUStats)(nil)) + state.Register((*IO)(nil)) } diff --git a/pkg/sentry/vfs/epoll_interest_list.go b/pkg/sentry/vfs/epoll_interest_list.go index 67104a9c6..ad8ae496a 100644 --- a/pkg/sentry/vfs/epoll_interest_list.go +++ b/pkg/sentry/vfs/epoll_interest_list.go @@ -56,7 +56,7 @@ func (l *epollInterestList) Back() *epollInterest { // // NOTE: This is an O(n) operation. func (l *epollInterestList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (epollInterestElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *epollInterestList) Remove(e *epollInterest) { if prev != nil { epollInterestElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { epollInterestElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/vfs/event_list.go b/pkg/sentry/vfs/event_list.go index 2ae5b6aba..ebfb272fd 100644 --- a/pkg/sentry/vfs/event_list.go +++ b/pkg/sentry/vfs/event_list.go @@ -56,7 +56,7 @@ func (l *eventList) Back() *Event { // // NOTE: This is an O(n) operation. func (l *eventList) Len() (count int) { - for e := l.Front(); e != nil; e = e.Next() { + for e := l.Front(); e != nil; e = (eventElementMapper{}.linkerFor(e)).Next() { count++ } return count @@ -148,13 +148,13 @@ func (l *eventList) Remove(e *Event) { if prev != nil { eventElementMapper{}.linkerFor(prev).SetNext(next) - } else { + } else if l.head == e { l.head = next } if next != nil { eventElementMapper{}.linkerFor(next).SetPrev(prev) - } else { + } else if l.tail == e { l.tail = prev } diff --git a/pkg/sentry/vfs/memxattr/memxattr_state_autogen.go b/pkg/sentry/vfs/memxattr/memxattr_state_autogen.go index 6b366cea4..105af5cb5 100644 --- a/pkg/sentry/vfs/memxattr/memxattr_state_autogen.go +++ b/pkg/sentry/vfs/memxattr/memxattr_state_autogen.go @@ -6,17 +6,29 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *SimpleExtendedAttributes) StateTypeName() string { + return "pkg/sentry/vfs/memxattr.SimpleExtendedAttributes" +} + +func (x *SimpleExtendedAttributes) StateFields() []string { + return []string{ + "xattrs", + } +} + func (x *SimpleExtendedAttributes) beforeSave() {} -func (x *SimpleExtendedAttributes) save(m state.Map) { + +func (x *SimpleExtendedAttributes) StateSave(m state.Sink) { x.beforeSave() - m.Save("xattrs", &x.xattrs) + m.Save(0, &x.xattrs) } func (x *SimpleExtendedAttributes) afterLoad() {} -func (x *SimpleExtendedAttributes) load(m state.Map) { - m.Load("xattrs", &x.xattrs) + +func (x *SimpleExtendedAttributes) StateLoad(m state.Source) { + m.Load(0, &x.xattrs) } func init() { - state.Register("pkg/sentry/vfs/memxattr.SimpleExtendedAttributes", (*SimpleExtendedAttributes)(nil), state.Fns{Save: (*SimpleExtendedAttributes).save, Load: (*SimpleExtendedAttributes).load}) + state.Register((*SimpleExtendedAttributes)(nil)) } diff --git a/pkg/sentry/vfs/vfs_state_autogen.go b/pkg/sentry/vfs/vfs_state_autogen.go index be27d746f..c1f514db4 100644 --- a/pkg/sentry/vfs/vfs_state_autogen.go +++ b/pkg/sentry/vfs/vfs_state_autogen.go @@ -6,307 +6,560 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *Dentry) StateTypeName() string { + return "pkg/sentry/vfs.Dentry" +} + +func (x *Dentry) StateFields() []string { + return []string{ + "dead", + "mounts", + "impl", + } +} + func (x *Dentry) beforeSave() {} -func (x *Dentry) save(m state.Map) { + +func (x *Dentry) StateSave(m state.Sink) { x.beforeSave() - m.Save("dead", &x.dead) - m.Save("mounts", &x.mounts) - m.Save("impl", &x.impl) + m.Save(0, &x.dead) + m.Save(1, &x.mounts) + m.Save(2, &x.impl) } func (x *Dentry) afterLoad() {} -func (x *Dentry) load(m state.Map) { - m.Load("dead", &x.dead) - m.Load("mounts", &x.mounts) - m.Load("impl", &x.impl) + +func (x *Dentry) StateLoad(m state.Source) { + m.Load(0, &x.dead) + m.Load(1, &x.mounts) + m.Load(2, &x.impl) +} + +func (x *registeredDevice) StateTypeName() string { + return "pkg/sentry/vfs.registeredDevice" +} + +func (x *registeredDevice) StateFields() []string { + return []string{ + "dev", + "opts", + } } func (x *registeredDevice) beforeSave() {} -func (x *registeredDevice) save(m state.Map) { + +func (x *registeredDevice) StateSave(m state.Sink) { x.beforeSave() - m.Save("dev", &x.dev) - m.Save("opts", &x.opts) + m.Save(0, &x.dev) + m.Save(1, &x.opts) } func (x *registeredDevice) afterLoad() {} -func (x *registeredDevice) load(m state.Map) { - m.Load("dev", &x.dev) - m.Load("opts", &x.opts) + +func (x *registeredDevice) StateLoad(m state.Source) { + m.Load(0, &x.dev) + m.Load(1, &x.opts) +} + +func (x *RegisterDeviceOptions) StateTypeName() string { + return "pkg/sentry/vfs.RegisterDeviceOptions" +} + +func (x *RegisterDeviceOptions) StateFields() []string { + return []string{ + "GroupName", + } } func (x *RegisterDeviceOptions) beforeSave() {} -func (x *RegisterDeviceOptions) save(m state.Map) { + +func (x *RegisterDeviceOptions) StateSave(m state.Sink) { x.beforeSave() - m.Save("GroupName", &x.GroupName) + m.Save(0, &x.GroupName) } func (x *RegisterDeviceOptions) afterLoad() {} -func (x *RegisterDeviceOptions) load(m state.Map) { - m.Load("GroupName", &x.GroupName) + +func (x *RegisterDeviceOptions) StateLoad(m state.Source) { + m.Load(0, &x.GroupName) +} + +func (x *epollInterestList) StateTypeName() string { + return "pkg/sentry/vfs.epollInterestList" +} + +func (x *epollInterestList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *epollInterestList) beforeSave() {} -func (x *epollInterestList) save(m state.Map) { + +func (x *epollInterestList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *epollInterestList) afterLoad() {} -func (x *epollInterestList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *epollInterestList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *epollInterestEntry) StateTypeName() string { + return "pkg/sentry/vfs.epollInterestEntry" +} + +func (x *epollInterestEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *epollInterestEntry) beforeSave() {} -func (x *epollInterestEntry) save(m state.Map) { + +func (x *epollInterestEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *epollInterestEntry) afterLoad() {} -func (x *epollInterestEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *epollInterestEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *eventList) StateTypeName() string { + return "pkg/sentry/vfs.eventList" +} + +func (x *eventList) StateFields() []string { + return []string{ + "head", + "tail", + } } func (x *eventList) beforeSave() {} -func (x *eventList) save(m state.Map) { + +func (x *eventList) StateSave(m state.Sink) { x.beforeSave() - m.Save("head", &x.head) - m.Save("tail", &x.tail) + m.Save(0, &x.head) + m.Save(1, &x.tail) } func (x *eventList) afterLoad() {} -func (x *eventList) load(m state.Map) { - m.Load("head", &x.head) - m.Load("tail", &x.tail) + +func (x *eventList) StateLoad(m state.Source) { + m.Load(0, &x.head) + m.Load(1, &x.tail) +} + +func (x *eventEntry) StateTypeName() string { + return "pkg/sentry/vfs.eventEntry" +} + +func (x *eventEntry) StateFields() []string { + return []string{ + "next", + "prev", + } } func (x *eventEntry) beforeSave() {} -func (x *eventEntry) save(m state.Map) { + +func (x *eventEntry) StateSave(m state.Sink) { x.beforeSave() - m.Save("next", &x.next) - m.Save("prev", &x.prev) + m.Save(0, &x.next) + m.Save(1, &x.prev) } func (x *eventEntry) afterLoad() {} -func (x *eventEntry) load(m state.Map) { - m.Load("next", &x.next) - m.Load("prev", &x.prev) + +func (x *eventEntry) StateLoad(m state.Source) { + m.Load(0, &x.next) + m.Load(1, &x.prev) +} + +func (x *Filesystem) StateTypeName() string { + return "pkg/sentry/vfs.Filesystem" +} + +func (x *Filesystem) StateFields() []string { + return []string{ + "refs", + "vfs", + "fsType", + "impl", + } } func (x *Filesystem) beforeSave() {} -func (x *Filesystem) save(m state.Map) { + +func (x *Filesystem) StateSave(m state.Sink) { x.beforeSave() - m.Save("refs", &x.refs) - m.Save("vfs", &x.vfs) - m.Save("fsType", &x.fsType) - m.Save("impl", &x.impl) + m.Save(0, &x.refs) + m.Save(1, &x.vfs) + m.Save(2, &x.fsType) + m.Save(3, &x.impl) } func (x *Filesystem) afterLoad() {} -func (x *Filesystem) load(m state.Map) { - m.Load("refs", &x.refs) - m.Load("vfs", &x.vfs) - m.Load("fsType", &x.fsType) - m.Load("impl", &x.impl) + +func (x *Filesystem) StateLoad(m state.Source) { + m.Load(0, &x.refs) + m.Load(1, &x.vfs) + m.Load(2, &x.fsType) + m.Load(3, &x.impl) +} + +func (x *registeredFilesystemType) StateTypeName() string { + return "pkg/sentry/vfs.registeredFilesystemType" +} + +func (x *registeredFilesystemType) StateFields() []string { + return []string{ + "fsType", + "opts", + } } func (x *registeredFilesystemType) beforeSave() {} -func (x *registeredFilesystemType) save(m state.Map) { + +func (x *registeredFilesystemType) StateSave(m state.Sink) { x.beforeSave() - m.Save("fsType", &x.fsType) - m.Save("opts", &x.opts) + m.Save(0, &x.fsType) + m.Save(1, &x.opts) } func (x *registeredFilesystemType) afterLoad() {} -func (x *registeredFilesystemType) load(m state.Map) { - m.Load("fsType", &x.fsType) - m.Load("opts", &x.opts) + +func (x *registeredFilesystemType) StateLoad(m state.Source) { + m.Load(0, &x.fsType) + m.Load(1, &x.opts) +} + +func (x *Inotify) StateTypeName() string { + return "pkg/sentry/vfs.Inotify" +} + +func (x *Inotify) StateFields() []string { + return []string{ + "vfsfd", + "FileDescriptionDefaultImpl", + "DentryMetadataFileDescriptionImpl", + "NoLockFD", + "id", + "events", + "scratch", + "nextWatchMinusOne", + "watches", + } } func (x *Inotify) beforeSave() {} -func (x *Inotify) save(m state.Map) { + +func (x *Inotify) StateSave(m state.Sink) { x.beforeSave() - m.Save("vfsfd", &x.vfsfd) - m.Save("FileDescriptionDefaultImpl", &x.FileDescriptionDefaultImpl) - m.Save("DentryMetadataFileDescriptionImpl", &x.DentryMetadataFileDescriptionImpl) - m.Save("NoLockFD", &x.NoLockFD) - m.Save("id", &x.id) - m.Save("events", &x.events) - m.Save("scratch", &x.scratch) - m.Save("nextWatchMinusOne", &x.nextWatchMinusOne) - m.Save("watches", &x.watches) + m.Save(0, &x.vfsfd) + m.Save(1, &x.FileDescriptionDefaultImpl) + m.Save(2, &x.DentryMetadataFileDescriptionImpl) + m.Save(3, &x.NoLockFD) + m.Save(4, &x.id) + m.Save(5, &x.events) + m.Save(6, &x.scratch) + m.Save(7, &x.nextWatchMinusOne) + m.Save(8, &x.watches) } func (x *Inotify) afterLoad() {} -func (x *Inotify) load(m state.Map) { - m.Load("vfsfd", &x.vfsfd) - m.Load("FileDescriptionDefaultImpl", &x.FileDescriptionDefaultImpl) - m.Load("DentryMetadataFileDescriptionImpl", &x.DentryMetadataFileDescriptionImpl) - m.Load("NoLockFD", &x.NoLockFD) - m.Load("id", &x.id) - m.Load("events", &x.events) - m.Load("scratch", &x.scratch) - m.Load("nextWatchMinusOne", &x.nextWatchMinusOne) - m.Load("watches", &x.watches) + +func (x *Inotify) StateLoad(m state.Source) { + m.Load(0, &x.vfsfd) + m.Load(1, &x.FileDescriptionDefaultImpl) + m.Load(2, &x.DentryMetadataFileDescriptionImpl) + m.Load(3, &x.NoLockFD) + m.Load(4, &x.id) + m.Load(5, &x.events) + m.Load(6, &x.scratch) + m.Load(7, &x.nextWatchMinusOne) + m.Load(8, &x.watches) +} + +func (x *Watches) StateTypeName() string { + return "pkg/sentry/vfs.Watches" +} + +func (x *Watches) StateFields() []string { + return []string{ + "ws", + } } func (x *Watches) beforeSave() {} -func (x *Watches) save(m state.Map) { + +func (x *Watches) StateSave(m state.Sink) { x.beforeSave() - m.Save("ws", &x.ws) + m.Save(0, &x.ws) } func (x *Watches) afterLoad() {} -func (x *Watches) load(m state.Map) { - m.Load("ws", &x.ws) + +func (x *Watches) StateLoad(m state.Source) { + m.Load(0, &x.ws) +} + +func (x *Watch) StateTypeName() string { + return "pkg/sentry/vfs.Watch" +} + +func (x *Watch) StateFields() []string { + return []string{ + "owner", + "wd", + "target", + "mask", + } } func (x *Watch) beforeSave() {} -func (x *Watch) save(m state.Map) { + +func (x *Watch) StateSave(m state.Sink) { x.beforeSave() - m.Save("owner", &x.owner) - m.Save("wd", &x.wd) - m.Save("target", &x.target) - m.Save("mask", &x.mask) + m.Save(0, &x.owner) + m.Save(1, &x.wd) + m.Save(2, &x.target) + m.Save(3, &x.mask) } func (x *Watch) afterLoad() {} -func (x *Watch) load(m state.Map) { - m.Load("owner", &x.owner) - m.Load("wd", &x.wd) - m.Load("target", &x.target) - m.Load("mask", &x.mask) + +func (x *Watch) StateLoad(m state.Source) { + m.Load(0, &x.owner) + m.Load(1, &x.wd) + m.Load(2, &x.target) + m.Load(3, &x.mask) +} + +func (x *Event) StateTypeName() string { + return "pkg/sentry/vfs.Event" +} + +func (x *Event) StateFields() []string { + return []string{ + "eventEntry", + "wd", + "mask", + "cookie", + "len", + "name", + } } func (x *Event) beforeSave() {} -func (x *Event) save(m state.Map) { + +func (x *Event) StateSave(m state.Sink) { x.beforeSave() - m.Save("eventEntry", &x.eventEntry) - m.Save("wd", &x.wd) - m.Save("mask", &x.mask) - m.Save("cookie", &x.cookie) - m.Save("len", &x.len) - m.Save("name", &x.name) + m.Save(0, &x.eventEntry) + m.Save(1, &x.wd) + m.Save(2, &x.mask) + m.Save(3, &x.cookie) + m.Save(4, &x.len) + m.Save(5, &x.name) } func (x *Event) afterLoad() {} -func (x *Event) load(m state.Map) { - m.Load("eventEntry", &x.eventEntry) - m.Load("wd", &x.wd) - m.Load("mask", &x.mask) - m.Load("cookie", &x.cookie) - m.Load("len", &x.len) - m.Load("name", &x.name) + +func (x *Event) StateLoad(m state.Source) { + m.Load(0, &x.eventEntry) + m.Load(1, &x.wd) + m.Load(2, &x.mask) + m.Load(3, &x.cookie) + m.Load(4, &x.len) + m.Load(5, &x.name) +} + +func (x *Mount) StateTypeName() string { + return "pkg/sentry/vfs.Mount" +} + +func (x *Mount) StateFields() []string { + return []string{ + "vfs", + "fs", + "root", + "ID", + "Flags", + "key", + "ns", + "refs", + "children", + "umounted", + "writers", + } } func (x *Mount) beforeSave() {} -func (x *Mount) save(m state.Map) { + +func (x *Mount) StateSave(m state.Sink) { x.beforeSave() - m.Save("vfs", &x.vfs) - m.Save("fs", &x.fs) - m.Save("root", &x.root) - m.Save("ID", &x.ID) - m.Save("Flags", &x.Flags) - m.Save("key", &x.key) - m.Save("ns", &x.ns) - m.Save("refs", &x.refs) - m.Save("children", &x.children) - m.Save("umounted", &x.umounted) - m.Save("writers", &x.writers) + m.Save(0, &x.vfs) + m.Save(1, &x.fs) + m.Save(2, &x.root) + m.Save(3, &x.ID) + m.Save(4, &x.Flags) + m.Save(5, &x.key) + m.Save(6, &x.ns) + m.Save(7, &x.refs) + m.Save(8, &x.children) + m.Save(9, &x.umounted) + m.Save(10, &x.writers) } func (x *Mount) afterLoad() {} -func (x *Mount) load(m state.Map) { - m.Load("vfs", &x.vfs) - m.Load("fs", &x.fs) - m.Load("root", &x.root) - m.Load("ID", &x.ID) - m.Load("Flags", &x.Flags) - m.Load("key", &x.key) - m.Load("ns", &x.ns) - m.Load("refs", &x.refs) - m.Load("children", &x.children) - m.Load("umounted", &x.umounted) - m.Load("writers", &x.writers) + +func (x *Mount) StateLoad(m state.Source) { + m.Load(0, &x.vfs) + m.Load(1, &x.fs) + m.Load(2, &x.root) + m.Load(3, &x.ID) + m.Load(4, &x.Flags) + m.Load(5, &x.key) + m.Load(6, &x.ns) + m.Load(7, &x.refs) + m.Load(8, &x.children) + m.Load(9, &x.umounted) + m.Load(10, &x.writers) +} + +func (x *MountNamespace) StateTypeName() string { + return "pkg/sentry/vfs.MountNamespace" +} + +func (x *MountNamespace) StateFields() []string { + return []string{ + "Owner", + "root", + "refs", + "mountpoints", + } } func (x *MountNamespace) beforeSave() {} -func (x *MountNamespace) save(m state.Map) { + +func (x *MountNamespace) StateSave(m state.Sink) { x.beforeSave() - m.Save("Owner", &x.Owner) - m.Save("root", &x.root) - m.Save("refs", &x.refs) - m.Save("mountpoints", &x.mountpoints) + m.Save(0, &x.Owner) + m.Save(1, &x.root) + m.Save(2, &x.refs) + m.Save(3, &x.mountpoints) } func (x *MountNamespace) afterLoad() {} -func (x *MountNamespace) load(m state.Map) { - m.Load("Owner", &x.Owner) - m.Load("root", &x.root) - m.Load("refs", &x.refs) - m.Load("mountpoints", &x.mountpoints) + +func (x *MountNamespace) StateLoad(m state.Source) { + m.Load(0, &x.Owner) + m.Load(1, &x.root) + m.Load(2, &x.refs) + m.Load(3, &x.mountpoints) +} + +func (x *VirtualFilesystem) StateTypeName() string { + return "pkg/sentry/vfs.VirtualFilesystem" +} + +func (x *VirtualFilesystem) StateFields() []string { + return []string{ + "mounts", + "mountpoints", + "lastMountID", + "anonMount", + "devices", + "anonBlockDevMinorNext", + "anonBlockDevMinor", + "fsTypes", + "filesystems", + } } func (x *VirtualFilesystem) beforeSave() {} -func (x *VirtualFilesystem) save(m state.Map) { + +func (x *VirtualFilesystem) StateSave(m state.Sink) { x.beforeSave() - m.Save("mounts", &x.mounts) - m.Save("mountpoints", &x.mountpoints) - m.Save("lastMountID", &x.lastMountID) - m.Save("anonMount", &x.anonMount) - m.Save("devices", &x.devices) - m.Save("anonBlockDevMinorNext", &x.anonBlockDevMinorNext) - m.Save("anonBlockDevMinor", &x.anonBlockDevMinor) - m.Save("fsTypes", &x.fsTypes) - m.Save("filesystems", &x.filesystems) + m.Save(0, &x.mounts) + m.Save(1, &x.mountpoints) + m.Save(2, &x.lastMountID) + m.Save(3, &x.anonMount) + m.Save(4, &x.devices) + m.Save(5, &x.anonBlockDevMinorNext) + m.Save(6, &x.anonBlockDevMinor) + m.Save(7, &x.fsTypes) + m.Save(8, &x.filesystems) } func (x *VirtualFilesystem) afterLoad() {} -func (x *VirtualFilesystem) load(m state.Map) { - m.Load("mounts", &x.mounts) - m.Load("mountpoints", &x.mountpoints) - m.Load("lastMountID", &x.lastMountID) - m.Load("anonMount", &x.anonMount) - m.Load("devices", &x.devices) - m.Load("anonBlockDevMinorNext", &x.anonBlockDevMinorNext) - m.Load("anonBlockDevMinor", &x.anonBlockDevMinor) - m.Load("fsTypes", &x.fsTypes) - m.Load("filesystems", &x.filesystems) + +func (x *VirtualFilesystem) StateLoad(m state.Source) { + m.Load(0, &x.mounts) + m.Load(1, &x.mountpoints) + m.Load(2, &x.lastMountID) + m.Load(3, &x.anonMount) + m.Load(4, &x.devices) + m.Load(5, &x.anonBlockDevMinorNext) + m.Load(6, &x.anonBlockDevMinor) + m.Load(7, &x.fsTypes) + m.Load(8, &x.filesystems) +} + +func (x *VirtualDentry) StateTypeName() string { + return "pkg/sentry/vfs.VirtualDentry" +} + +func (x *VirtualDentry) StateFields() []string { + return []string{ + "mount", + "dentry", + } } func (x *VirtualDentry) beforeSave() {} -func (x *VirtualDentry) save(m state.Map) { + +func (x *VirtualDentry) StateSave(m state.Sink) { x.beforeSave() - m.Save("mount", &x.mount) - m.Save("dentry", &x.dentry) + m.Save(0, &x.mount) + m.Save(1, &x.dentry) } func (x *VirtualDentry) afterLoad() {} -func (x *VirtualDentry) load(m state.Map) { - m.Load("mount", &x.mount) - m.Load("dentry", &x.dentry) + +func (x *VirtualDentry) StateLoad(m state.Source) { + m.Load(0, &x.mount) + m.Load(1, &x.dentry) } func init() { - state.Register("pkg/sentry/vfs.Dentry", (*Dentry)(nil), state.Fns{Save: (*Dentry).save, Load: (*Dentry).load}) - state.Register("pkg/sentry/vfs.registeredDevice", (*registeredDevice)(nil), state.Fns{Save: (*registeredDevice).save, Load: (*registeredDevice).load}) - state.Register("pkg/sentry/vfs.RegisterDeviceOptions", (*RegisterDeviceOptions)(nil), state.Fns{Save: (*RegisterDeviceOptions).save, Load: (*RegisterDeviceOptions).load}) - state.Register("pkg/sentry/vfs.epollInterestList", (*epollInterestList)(nil), state.Fns{Save: (*epollInterestList).save, Load: (*epollInterestList).load}) - state.Register("pkg/sentry/vfs.epollInterestEntry", (*epollInterestEntry)(nil), state.Fns{Save: (*epollInterestEntry).save, Load: (*epollInterestEntry).load}) - state.Register("pkg/sentry/vfs.eventList", (*eventList)(nil), state.Fns{Save: (*eventList).save, Load: (*eventList).load}) - state.Register("pkg/sentry/vfs.eventEntry", (*eventEntry)(nil), state.Fns{Save: (*eventEntry).save, Load: (*eventEntry).load}) - state.Register("pkg/sentry/vfs.Filesystem", (*Filesystem)(nil), state.Fns{Save: (*Filesystem).save, Load: (*Filesystem).load}) - state.Register("pkg/sentry/vfs.registeredFilesystemType", (*registeredFilesystemType)(nil), state.Fns{Save: (*registeredFilesystemType).save, Load: (*registeredFilesystemType).load}) - state.Register("pkg/sentry/vfs.Inotify", (*Inotify)(nil), state.Fns{Save: (*Inotify).save, Load: (*Inotify).load}) - state.Register("pkg/sentry/vfs.Watches", (*Watches)(nil), state.Fns{Save: (*Watches).save, Load: (*Watches).load}) - state.Register("pkg/sentry/vfs.Watch", (*Watch)(nil), state.Fns{Save: (*Watch).save, Load: (*Watch).load}) - state.Register("pkg/sentry/vfs.Event", (*Event)(nil), state.Fns{Save: (*Event).save, Load: (*Event).load}) - state.Register("pkg/sentry/vfs.Mount", (*Mount)(nil), state.Fns{Save: (*Mount).save, Load: (*Mount).load}) - state.Register("pkg/sentry/vfs.MountNamespace", (*MountNamespace)(nil), state.Fns{Save: (*MountNamespace).save, Load: (*MountNamespace).load}) - state.Register("pkg/sentry/vfs.VirtualFilesystem", (*VirtualFilesystem)(nil), state.Fns{Save: (*VirtualFilesystem).save, Load: (*VirtualFilesystem).load}) - state.Register("pkg/sentry/vfs.VirtualDentry", (*VirtualDentry)(nil), state.Fns{Save: (*VirtualDentry).save, Load: (*VirtualDentry).load}) + state.Register((*Dentry)(nil)) + state.Register((*registeredDevice)(nil)) + state.Register((*RegisterDeviceOptions)(nil)) + state.Register((*epollInterestList)(nil)) + state.Register((*epollInterestEntry)(nil)) + state.Register((*eventList)(nil)) + state.Register((*eventEntry)(nil)) + state.Register((*Filesystem)(nil)) + state.Register((*registeredFilesystemType)(nil)) + state.Register((*Inotify)(nil)) + state.Register((*Watches)(nil)) + state.Register((*Watch)(nil)) + state.Register((*Event)(nil)) + state.Register((*Mount)(nil)) + state.Register((*MountNamespace)(nil)) + state.Register((*VirtualFilesystem)(nil)) + state.Register((*VirtualDentry)(nil)) } diff --git a/pkg/sentry/vfs/vfs_unsafe_state_autogen.go b/pkg/sentry/vfs/vfs_unsafe_state_autogen.go index ca9946ce4..37c5926c4 100644 --- a/pkg/sentry/vfs/vfs_unsafe_state_autogen.go +++ b/pkg/sentry/vfs/vfs_unsafe_state_autogen.go @@ -9,19 +9,32 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *mountTable) StateTypeName() string { + return "pkg/sentry/vfs.mountTable" +} + +func (x *mountTable) StateFields() []string { + return []string{ + "seed", + "size", + } +} + func (x *mountTable) beforeSave() {} -func (x *mountTable) save(m state.Map) { + +func (x *mountTable) StateSave(m state.Sink) { x.beforeSave() - m.Save("seed", &x.seed) - m.Save("size", &x.size) + m.Save(0, &x.seed) + m.Save(1, &x.size) } func (x *mountTable) afterLoad() {} -func (x *mountTable) load(m state.Map) { - m.Load("seed", &x.seed) - m.Load("size", &x.size) + +func (x *mountTable) StateLoad(m state.Source) { + m.Load(0, &x.seed) + m.Load(1, &x.size) } func init() { - state.Register("pkg/sentry/vfs.mountTable", (*mountTable)(nil), state.Fns{Save: (*mountTable).save, Load: (*mountTable).load}) + state.Register((*mountTable)(nil)) } |