diff options
Diffstat (limited to 'pkg/abi/linux')
-rw-r--r-- | pkg/abi/linux/linux_abi_autogen_unsafe.go | 4 | ||||
-rw-r--r-- | pkg/abi/linux/linux_amd64_state_autogen.go | 152 | ||||
-rw-r--r-- | pkg/abi/linux/linux_arm64_state_autogen.go | 37 | ||||
-rw-r--r-- | pkg/abi/linux/linux_state_autogen.go | 158 |
4 files changed, 233 insertions, 118 deletions
diff --git a/pkg/abi/linux/linux_abi_autogen_unsafe.go b/pkg/abi/linux/linux_abi_autogen_unsafe.go index 285e270b7..868b27001 100644 --- a/pkg/abi/linux/linux_abi_autogen_unsafe.go +++ b/pkg/abi/linux/linux_abi_autogen_unsafe.go @@ -138,7 +138,7 @@ func (s *Statx) MarshalUnsafe(dst []byte) { // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. func (s *Statx) UnmarshalUnsafe(src []byte) { - if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { + if s.Ctime.Packed() && s.Mtime.Packed() && s.Atime.Packed() && s.Btime.Packed() { safecopy.CopyOut(unsafe.Pointer(s), src) } else { s.UnmarshalBytes(src) @@ -178,7 +178,7 @@ func (s *Statx) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) { // CopyIn implements marshal.Marshallable.CopyIn. //go:nosplit func (s *Statx) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) { - if !s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() && s.Atime.Packed() { + if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. buf := task.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. length, err := task.CopyInBytes(addr, buf) // escapes: okay. diff --git a/pkg/abi/linux/linux_amd64_state_autogen.go b/pkg/abi/linux/linux_amd64_state_autogen.go index 58cabce4c..474bb3e65 100644 --- a/pkg/abi/linux/linux_amd64_state_autogen.go +++ b/pkg/abi/linux/linux_amd64_state_autogen.go @@ -11,69 +11,107 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *PtraceRegs) StateTypeName() string { + return "pkg/abi/linux.PtraceRegs" +} + +func (x *PtraceRegs) StateFields() []string { + return []string{ + "R15", + "R14", + "R13", + "R12", + "Rbp", + "Rbx", + "R11", + "R10", + "R9", + "R8", + "Rax", + "Rcx", + "Rdx", + "Rsi", + "Rdi", + "Orig_rax", + "Rip", + "Cs", + "Eflags", + "Rsp", + "Ss", + "Fs_base", + "Gs_base", + "Ds", + "Es", + "Fs", + "Gs", + } +} + func (x *PtraceRegs) beforeSave() {} -func (x *PtraceRegs) save(m state.Map) { + +func (x *PtraceRegs) StateSave(m state.Sink) { x.beforeSave() - m.Save("R15", &x.R15) - m.Save("R14", &x.R14) - m.Save("R13", &x.R13) - m.Save("R12", &x.R12) - m.Save("Rbp", &x.Rbp) - m.Save("Rbx", &x.Rbx) - m.Save("R11", &x.R11) - m.Save("R10", &x.R10) - m.Save("R9", &x.R9) - m.Save("R8", &x.R8) - m.Save("Rax", &x.Rax) - m.Save("Rcx", &x.Rcx) - m.Save("Rdx", &x.Rdx) - m.Save("Rsi", &x.Rsi) - m.Save("Rdi", &x.Rdi) - m.Save("Orig_rax", &x.Orig_rax) - m.Save("Rip", &x.Rip) - m.Save("Cs", &x.Cs) - m.Save("Eflags", &x.Eflags) - m.Save("Rsp", &x.Rsp) - m.Save("Ss", &x.Ss) - m.Save("Fs_base", &x.Fs_base) - m.Save("Gs_base", &x.Gs_base) - m.Save("Ds", &x.Ds) - m.Save("Es", &x.Es) - m.Save("Fs", &x.Fs) - m.Save("Gs", &x.Gs) + m.Save(0, &x.R15) + m.Save(1, &x.R14) + m.Save(2, &x.R13) + m.Save(3, &x.R12) + m.Save(4, &x.Rbp) + m.Save(5, &x.Rbx) + m.Save(6, &x.R11) + m.Save(7, &x.R10) + m.Save(8, &x.R9) + m.Save(9, &x.R8) + m.Save(10, &x.Rax) + m.Save(11, &x.Rcx) + m.Save(12, &x.Rdx) + m.Save(13, &x.Rsi) + m.Save(14, &x.Rdi) + m.Save(15, &x.Orig_rax) + m.Save(16, &x.Rip) + m.Save(17, &x.Cs) + m.Save(18, &x.Eflags) + m.Save(19, &x.Rsp) + m.Save(20, &x.Ss) + m.Save(21, &x.Fs_base) + m.Save(22, &x.Gs_base) + m.Save(23, &x.Ds) + m.Save(24, &x.Es) + m.Save(25, &x.Fs) + m.Save(26, &x.Gs) } func (x *PtraceRegs) afterLoad() {} -func (x *PtraceRegs) load(m state.Map) { - m.Load("R15", &x.R15) - m.Load("R14", &x.R14) - m.Load("R13", &x.R13) - m.Load("R12", &x.R12) - m.Load("Rbp", &x.Rbp) - m.Load("Rbx", &x.Rbx) - m.Load("R11", &x.R11) - m.Load("R10", &x.R10) - m.Load("R9", &x.R9) - m.Load("R8", &x.R8) - m.Load("Rax", &x.Rax) - m.Load("Rcx", &x.Rcx) - m.Load("Rdx", &x.Rdx) - m.Load("Rsi", &x.Rsi) - m.Load("Rdi", &x.Rdi) - m.Load("Orig_rax", &x.Orig_rax) - m.Load("Rip", &x.Rip) - m.Load("Cs", &x.Cs) - m.Load("Eflags", &x.Eflags) - m.Load("Rsp", &x.Rsp) - m.Load("Ss", &x.Ss) - m.Load("Fs_base", &x.Fs_base) - m.Load("Gs_base", &x.Gs_base) - m.Load("Ds", &x.Ds) - m.Load("Es", &x.Es) - m.Load("Fs", &x.Fs) - m.Load("Gs", &x.Gs) + +func (x *PtraceRegs) StateLoad(m state.Source) { + m.Load(0, &x.R15) + m.Load(1, &x.R14) + m.Load(2, &x.R13) + m.Load(3, &x.R12) + m.Load(4, &x.Rbp) + m.Load(5, &x.Rbx) + m.Load(6, &x.R11) + m.Load(7, &x.R10) + m.Load(8, &x.R9) + m.Load(9, &x.R8) + m.Load(10, &x.Rax) + m.Load(11, &x.Rcx) + m.Load(12, &x.Rdx) + m.Load(13, &x.Rsi) + m.Load(14, &x.Rdi) + m.Load(15, &x.Orig_rax) + m.Load(16, &x.Rip) + m.Load(17, &x.Cs) + m.Load(18, &x.Eflags) + m.Load(19, &x.Rsp) + m.Load(20, &x.Ss) + m.Load(21, &x.Fs_base) + m.Load(22, &x.Gs_base) + m.Load(23, &x.Ds) + m.Load(24, &x.Es) + m.Load(25, &x.Fs) + m.Load(26, &x.Gs) } func init() { - state.Register("pkg/abi/linux.PtraceRegs", (*PtraceRegs)(nil), state.Fns{Save: (*PtraceRegs).save, Load: (*PtraceRegs).load}) + state.Register((*PtraceRegs)(nil)) } diff --git a/pkg/abi/linux/linux_arm64_state_autogen.go b/pkg/abi/linux/linux_arm64_state_autogen.go index 301a5cb76..30c6bef55 100644 --- a/pkg/abi/linux/linux_arm64_state_autogen.go +++ b/pkg/abi/linux/linux_arm64_state_autogen.go @@ -10,23 +10,38 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *PtraceRegs) StateTypeName() string { + return "pkg/abi/linux.PtraceRegs" +} + +func (x *PtraceRegs) StateFields() []string { + return []string{ + "Regs", + "Sp", + "Pc", + "Pstate", + } +} + func (x *PtraceRegs) beforeSave() {} -func (x *PtraceRegs) save(m state.Map) { + +func (x *PtraceRegs) StateSave(m state.Sink) { x.beforeSave() - m.Save("Regs", &x.Regs) - m.Save("Sp", &x.Sp) - m.Save("Pc", &x.Pc) - m.Save("Pstate", &x.Pstate) + m.Save(0, &x.Regs) + m.Save(1, &x.Sp) + m.Save(2, &x.Pc) + m.Save(3, &x.Pstate) } func (x *PtraceRegs) afterLoad() {} -func (x *PtraceRegs) load(m state.Map) { - m.Load("Regs", &x.Regs) - m.Load("Sp", &x.Sp) - m.Load("Pc", &x.Pc) - m.Load("Pstate", &x.Pstate) + +func (x *PtraceRegs) StateLoad(m state.Source) { + m.Load(0, &x.Regs) + m.Load(1, &x.Sp) + m.Load(2, &x.Pc) + m.Load(3, &x.Pstate) } func init() { - state.Register("pkg/abi/linux.PtraceRegs", (*PtraceRegs)(nil), state.Fns{Save: (*PtraceRegs).save, Load: (*PtraceRegs).load}) + state.Register((*PtraceRegs)(nil)) } diff --git a/pkg/abi/linux/linux_state_autogen.go b/pkg/abi/linux/linux_state_autogen.go index 67da4be84..a2bfcd215 100644 --- a/pkg/abi/linux/linux_state_autogen.go +++ b/pkg/abi/linux/linux_state_autogen.go @@ -6,81 +6,143 @@ import ( "gvisor.dev/gvisor/pkg/state" ) +func (x *IOEvent) StateTypeName() string { + return "pkg/abi/linux.IOEvent" +} + +func (x *IOEvent) StateFields() []string { + return []string{ + "Data", + "Obj", + "Result", + "Result2", + } +} + func (x *IOEvent) beforeSave() {} -func (x *IOEvent) save(m state.Map) { + +func (x *IOEvent) StateSave(m state.Sink) { x.beforeSave() - m.Save("Data", &x.Data) - m.Save("Obj", &x.Obj) - m.Save("Result", &x.Result) - m.Save("Result2", &x.Result2) + m.Save(0, &x.Data) + m.Save(1, &x.Obj) + m.Save(2, &x.Result) + m.Save(3, &x.Result2) } func (x *IOEvent) afterLoad() {} -func (x *IOEvent) load(m state.Map) { - m.Load("Data", &x.Data) - m.Load("Obj", &x.Obj) - m.Load("Result", &x.Result) - m.Load("Result2", &x.Result2) + +func (x *IOEvent) StateLoad(m state.Source) { + m.Load(0, &x.Data) + m.Load(1, &x.Obj) + m.Load(2, &x.Result) + m.Load(3, &x.Result2) +} + +func (x *BPFInstruction) StateTypeName() string { + return "pkg/abi/linux.BPFInstruction" +} + +func (x *BPFInstruction) StateFields() []string { + return []string{ + "OpCode", + "JumpIfTrue", + "JumpIfFalse", + "K", + } } func (x *BPFInstruction) beforeSave() {} -func (x *BPFInstruction) save(m state.Map) { + +func (x *BPFInstruction) StateSave(m state.Sink) { x.beforeSave() - m.Save("OpCode", &x.OpCode) - m.Save("JumpIfTrue", &x.JumpIfTrue) - m.Save("JumpIfFalse", &x.JumpIfFalse) - m.Save("K", &x.K) + m.Save(0, &x.OpCode) + m.Save(1, &x.JumpIfTrue) + m.Save(2, &x.JumpIfFalse) + m.Save(3, &x.K) } func (x *BPFInstruction) afterLoad() {} -func (x *BPFInstruction) load(m state.Map) { - m.Load("OpCode", &x.OpCode) - m.Load("JumpIfTrue", &x.JumpIfTrue) - m.Load("JumpIfFalse", &x.JumpIfFalse) - m.Load("K", &x.K) + +func (x *BPFInstruction) StateLoad(m state.Source) { + m.Load(0, &x.OpCode) + m.Load(1, &x.JumpIfTrue) + m.Load(2, &x.JumpIfFalse) + m.Load(3, &x.K) +} + +func (x *KernelTermios) StateTypeName() string { + return "pkg/abi/linux.KernelTermios" +} + +func (x *KernelTermios) StateFields() []string { + return []string{ + "InputFlags", + "OutputFlags", + "ControlFlags", + "LocalFlags", + "LineDiscipline", + "ControlCharacters", + "InputSpeed", + "OutputSpeed", + } } func (x *KernelTermios) beforeSave() {} -func (x *KernelTermios) save(m state.Map) { + +func (x *KernelTermios) StateSave(m state.Sink) { x.beforeSave() - m.Save("InputFlags", &x.InputFlags) - m.Save("OutputFlags", &x.OutputFlags) - m.Save("ControlFlags", &x.ControlFlags) - m.Save("LocalFlags", &x.LocalFlags) - m.Save("LineDiscipline", &x.LineDiscipline) - m.Save("ControlCharacters", &x.ControlCharacters) - m.Save("InputSpeed", &x.InputSpeed) - m.Save("OutputSpeed", &x.OutputSpeed) + m.Save(0, &x.InputFlags) + m.Save(1, &x.OutputFlags) + m.Save(2, &x.ControlFlags) + m.Save(3, &x.LocalFlags) + m.Save(4, &x.LineDiscipline) + m.Save(5, &x.ControlCharacters) + m.Save(6, &x.InputSpeed) + m.Save(7, &x.OutputSpeed) } func (x *KernelTermios) afterLoad() {} -func (x *KernelTermios) load(m state.Map) { - m.Load("InputFlags", &x.InputFlags) - m.Load("OutputFlags", &x.OutputFlags) - m.Load("ControlFlags", &x.ControlFlags) - m.Load("LocalFlags", &x.LocalFlags) - m.Load("LineDiscipline", &x.LineDiscipline) - m.Load("ControlCharacters", &x.ControlCharacters) - m.Load("InputSpeed", &x.InputSpeed) - m.Load("OutputSpeed", &x.OutputSpeed) + +func (x *KernelTermios) StateLoad(m state.Source) { + m.Load(0, &x.InputFlags) + m.Load(1, &x.OutputFlags) + m.Load(2, &x.ControlFlags) + m.Load(3, &x.LocalFlags) + m.Load(4, &x.LineDiscipline) + m.Load(5, &x.ControlCharacters) + m.Load(6, &x.InputSpeed) + m.Load(7, &x.OutputSpeed) +} + +func (x *WindowSize) StateTypeName() string { + return "pkg/abi/linux.WindowSize" +} + +func (x *WindowSize) StateFields() []string { + return []string{ + "Rows", + "Cols", + } } func (x *WindowSize) beforeSave() {} -func (x *WindowSize) save(m state.Map) { + +func (x *WindowSize) StateSave(m state.Sink) { x.beforeSave() - m.Save("Rows", &x.Rows) - m.Save("Cols", &x.Cols) + m.Save(0, &x.Rows) + m.Save(1, &x.Cols) } func (x *WindowSize) afterLoad() {} -func (x *WindowSize) load(m state.Map) { - m.Load("Rows", &x.Rows) - m.Load("Cols", &x.Cols) + +func (x *WindowSize) StateLoad(m state.Source) { + m.Load(0, &x.Rows) + m.Load(1, &x.Cols) } func init() { - state.Register("pkg/abi/linux.IOEvent", (*IOEvent)(nil), state.Fns{Save: (*IOEvent).save, Load: (*IOEvent).load}) - state.Register("pkg/abi/linux.BPFInstruction", (*BPFInstruction)(nil), state.Fns{Save: (*BPFInstruction).save, Load: (*BPFInstruction).load}) - state.Register("pkg/abi/linux.KernelTermios", (*KernelTermios)(nil), state.Fns{Save: (*KernelTermios).save, Load: (*KernelTermios).load}) - state.Register("pkg/abi/linux.WindowSize", (*WindowSize)(nil), state.Fns{Save: (*WindowSize).save, Load: (*WindowSize).load}) + state.Register((*IOEvent)(nil)) + state.Register((*BPFInstruction)(nil)) + state.Register((*KernelTermios)(nil)) + state.Register((*WindowSize)(nil)) } |