diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-11-05 17:48:53 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-11-05 17:48:53 +0000 |
commit | f62d5f516175c78eff1857ca938e2c53afb6b7a5 (patch) | |
tree | 6203c02fcf397d3a8059f4b2df4d607ca432579e /pkg/sentry/syscalls/linux/vfs2 | |
parent | a1f6772e7e32a6d8899e5511d226ac7f9b017455 (diff) | |
parent | ce4f4283badb6b07baf9f8e6d99e7a5fd15c92db (diff) |
Merge release-20211101.0-21-gce4f4283b (automated)
Diffstat (limited to 'pkg/sentry/syscalls/linux/vfs2')
-rw-r--r-- | pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go | 70 |
1 files changed, 42 insertions, 28 deletions
diff --git a/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go b/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go index 01b0d465f..fbbb520b9 100644 --- a/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go +++ b/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go @@ -23,19 +23,21 @@ func (s *sigSetWithSize) SizeBytes() int { } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (s *sigSetWithSize) MarshalBytes(dst []byte) { +func (s *sigSetWithSize) MarshalBytes(dst []byte) []byte { hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.sigsetAddr)) dst = dst[8:] hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.sizeofSigset)) dst = dst[8:] + return dst } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (s *sigSetWithSize) UnmarshalBytes(src []byte) { +func (s *sigSetWithSize) UnmarshalBytes(src []byte) []byte { s.sigsetAddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) src = src[8:] s.sizeofSigset = uint64(hostarch.ByteOrder.Uint64(src[:8])) src = src[8:] + return src } // Packed implements marshal.Marshallable.Packed. @@ -45,13 +47,17 @@ func (s *sigSetWithSize) Packed() bool { } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (s *sigSetWithSize) MarshalUnsafe(dst []byte) { - gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(s.SizeBytes())) +func (s *sigSetWithSize) MarshalUnsafe(dst []byte) []byte { + size := s.SizeBytes() + gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) + return dst[size:] } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (s *sigSetWithSize) UnmarshalUnsafe(src []byte) { - gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(s.SizeBytes())) +func (s *sigSetWithSize) UnmarshalUnsafe(src []byte) []byte { + size := s.SizeBytes() + gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) + return src[size:] } // CopyOutN implements marshal.Marshallable.CopyOutN. @@ -116,7 +122,7 @@ func (m *MessageHeader64) SizeBytes() int { } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (m *MessageHeader64) MarshalBytes(dst []byte) { +func (m *MessageHeader64) MarshalBytes(dst []byte) []byte { hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.Name)) dst = dst[8:] hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.NameLen)) @@ -135,10 +141,11 @@ func (m *MessageHeader64) MarshalBytes(dst []byte) { dst = dst[4:] // Padding: dst[:sizeof(int32)] ~= int32(0) dst = dst[4:] + return dst } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (m *MessageHeader64) UnmarshalBytes(src []byte) { +func (m *MessageHeader64) UnmarshalBytes(src []byte) []byte { m.Name = uint64(hostarch.ByteOrder.Uint64(src[:8])) src = src[8:] m.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4])) @@ -157,6 +164,7 @@ func (m *MessageHeader64) UnmarshalBytes(src []byte) { src = src[4:] // Padding: var _ int32 ~= src[:sizeof(int32)] src = src[4:] + return src } // Packed implements marshal.Marshallable.Packed. @@ -166,13 +174,17 @@ func (m *MessageHeader64) Packed() bool { } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (m *MessageHeader64) MarshalUnsafe(dst []byte) { - gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes())) +func (m *MessageHeader64) MarshalUnsafe(dst []byte) []byte { + size := m.SizeBytes() + gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) + return dst[size:] } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (m *MessageHeader64) UnmarshalUnsafe(src []byte) { - gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes())) +func (m *MessageHeader64) UnmarshalUnsafe(src []byte) []byte { + size := m.SizeBytes() + gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) + return src[size:] } // CopyOutN implements marshal.Marshallable.CopyOutN. @@ -238,23 +250,23 @@ func (m *multipleMessageHeader64) SizeBytes() int { } // MarshalBytes implements marshal.Marshallable.MarshalBytes. -func (m *multipleMessageHeader64) MarshalBytes(dst []byte) { - m.msgHdr.MarshalBytes(dst[:m.msgHdr.SizeBytes()]) - dst = dst[m.msgHdr.SizeBytes():] +func (m *multipleMessageHeader64) MarshalBytes(dst []byte) []byte { + dst = m.msgHdr.MarshalBytes(dst) hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.msgLen)) dst = dst[4:] // Padding: dst[:sizeof(int32)] ~= int32(0) dst = dst[4:] + return dst } // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. -func (m *multipleMessageHeader64) UnmarshalBytes(src []byte) { - m.msgHdr.UnmarshalBytes(src[:m.msgHdr.SizeBytes()]) - src = src[m.msgHdr.SizeBytes():] +func (m *multipleMessageHeader64) UnmarshalBytes(src []byte) []byte { + src = m.msgHdr.UnmarshalBytes(src) m.msgLen = uint32(hostarch.ByteOrder.Uint32(src[:4])) src = src[4:] // Padding: var _ int32 ~= src[:sizeof(int32)] src = src[4:] + return src } // Packed implements marshal.Marshallable.Packed. @@ -264,23 +276,25 @@ func (m *multipleMessageHeader64) Packed() bool { } // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. -func (m *multipleMessageHeader64) MarshalUnsafe(dst []byte) { +func (m *multipleMessageHeader64) MarshalUnsafe(dst []byte) []byte { if m.msgHdr.Packed() { - gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(m.SizeBytes())) - } else { - // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to MarshalBytes. - m.MarshalBytes(dst) + size := m.SizeBytes() + gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) + return dst[size:] } + // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to MarshalBytes. + return m.MarshalBytes(dst) } // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. -func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) { +func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) []byte { if m.msgHdr.Packed() { - gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(m.SizeBytes())) - } else { - // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to UnmarshalBytes. - m.UnmarshalBytes(src) + size := m.SizeBytes() + gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) + return src[size:] } + // Type multipleMessageHeader64 doesn't have a packed layout in memory, fallback to UnmarshalBytes. + return m.UnmarshalBytes(src) } // CopyOutN implements marshal.Marshallable.CopyOutN. |