summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-09-16 09:13:19 +0000
committergVisor bot <gvisor-bot@google.com>2020-09-16 09:13:19 +0000
commitce5807fdb4a544ef045be0f8641aa88341ca1f9a (patch)
tree91c5040b4555592a65472496d274dfb9dd14188f /pkg/sentry
parent6ca48576e8a40e169dc10e17084bbceecf8a0055 (diff)
parent9ef1c7992232e82b8e6214dd1dd61a23ee9419a9 (diff)
Merge release-20200907.0-58-g9ef1c7992 (automated)
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/arch/arch_abi_autogen_unsafe.go44
-rw-r--r--pkg/sentry/fsimpl/devpts/root_inode_refs.go3
-rw-r--r--pkg/sentry/fsimpl/fuse/inode_refs.go3
-rw-r--r--pkg/sentry/fsimpl/host/connected_endpoint_refs.go3
-rw-r--r--pkg/sentry/fsimpl/host/inode_refs.go3
-rw-r--r--pkg/sentry/fsimpl/kernfs/dentry_refs.go3
-rw-r--r--pkg/sentry/fsimpl/kernfs/static_directory_refs.go3
-rw-r--r--pkg/sentry/fsimpl/proc/fd_dir_inode_refs.go3
-rw-r--r--pkg/sentry/fsimpl/proc/fd_info_dir_inode_refs.go3
-rw-r--r--pkg/sentry/fsimpl/proc/subtasks_inode_refs.go3
-rw-r--r--pkg/sentry/fsimpl/proc/task_inode_refs.go3
-rw-r--r--pkg/sentry/fsimpl/proc/tasks_inode_refs.go3
-rw-r--r--pkg/sentry/fsimpl/sys/dir_refs.go3
-rw-r--r--pkg/sentry/fsimpl/tmpfs/inode_refs.go3
-rw-r--r--pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go32
-rw-r--r--pkg/sentry/kernel/fd_table_refs.go3
-rw-r--r--pkg/sentry/kernel/fs_context_refs.go3
-rw-r--r--pkg/sentry/kernel/kernel_abi_autogen_unsafe.go12
-rw-r--r--pkg/sentry/kernel/process_group_refs.go3
-rw-r--r--pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go6
-rw-r--r--pkg/sentry/kernel/session_refs.go3
-rw-r--r--pkg/sentry/kernel/shm/shm_refs.go3
-rw-r--r--pkg/sentry/kernel/task_usermem.go17
-rw-r--r--pkg/sentry/mm/aio_mappable_refs.go3
-rw-r--r--pkg/sentry/mm/special_mappable_refs.go3
-rw-r--r--pkg/sentry/platform/ring0/defs_impl_arm64.go6
-rw-r--r--pkg/sentry/socket/unix/socket_refs.go3
-rw-r--r--pkg/sentry/socket/unix/transport/queue_refs.go3
-rw-r--r--pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go100
-rw-r--r--pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go44
-rw-r--r--pkg/sentry/time/seqatomic_parameters_unsafe.go6
-rw-r--r--pkg/sentry/vfs/file_description_refs.go3
-rw-r--r--pkg/sentry/vfs/filesystem_refs.go3
-rw-r--r--pkg/sentry/vfs/mount_namespace_refs.go3
34 files changed, 159 insertions, 183 deletions
diff --git a/pkg/sentry/arch/arch_abi_autogen_unsafe.go b/pkg/sentry/arch/arch_abi_autogen_unsafe.go
index 6a1b41bf6..fe68f921d 100644
--- a/pkg/sentry/arch/arch_abi_autogen_unsafe.go
+++ b/pkg/sentry/arch/arch_abi_autogen_unsafe.go
@@ -80,12 +80,12 @@ func (s *SignalAct) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (s *SignalAct) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (s *SignalAct) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
if !s.Mask.Packed() {
// Type SignalAct doesn't have a packed layout in memory, fall back to MarshalBytes.
- buf := task.CopyScratchBuffer(s.SizeBytes()) // escapes: okay.
+ buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay.
s.MarshalBytes(buf) // escapes: fallback.
- return task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
}
// Construct a slice backed by dst's underlying memory.
@@ -95,7 +95,7 @@ func (s *SignalAct) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (i
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -104,17 +104,17 @@ func (s *SignalAct) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (i
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (s *SignalAct) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return s.CopyOutN(task, addr, s.SizeBytes())
+func (s *SignalAct) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return s.CopyOutN(cc, addr, s.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (s *SignalAct) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (s *SignalAct) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
if !s.Mask.Packed() {
// Type SignalAct 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.
+ buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Unmarshal unconditionally. If we had a short copy-in, this results in a
// partially unmarshalled struct.
s.UnmarshalBytes(buf) // escapes: fallback.
@@ -128,7 +128,7 @@ func (s *SignalAct) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -206,7 +206,7 @@ func (s *SignalStack) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (s *SignalStack) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (s *SignalStack) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -214,7 +214,7 @@ func (s *SignalStack) CopyOutN(task marshal.Task, addr usermem.Addr, limit int)
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -223,13 +223,13 @@ func (s *SignalStack) CopyOutN(task marshal.Task, addr usermem.Addr, limit int)
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (s *SignalStack) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return s.CopyOutN(task, addr, s.SizeBytes())
+func (s *SignalStack) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return s.CopyOutN(cc, addr, s.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (s *SignalStack) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (s *SignalStack) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -237,7 +237,7 @@ func (s *SignalStack) CopyIn(task marshal.Task, addr usermem.Addr) (int, error)
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -316,7 +316,7 @@ func (s *SignalInfo) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (s *SignalInfo) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (s *SignalInfo) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -324,7 +324,7 @@ func (s *SignalInfo) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -333,13 +333,13 @@ func (s *SignalInfo) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (s *SignalInfo) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return s.CopyOutN(task, addr, s.SizeBytes())
+func (s *SignalInfo) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return s.CopyOutN(cc, addr, s.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (s *SignalInfo) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (s *SignalInfo) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -347,7 +347,7 @@ func (s *SignalInfo) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
diff --git a/pkg/sentry/fsimpl/devpts/root_inode_refs.go b/pkg/sentry/fsimpl/devpts/root_inode_refs.go
index 1b7090229..4abb66431 100644
--- a/pkg/sentry/fsimpl/devpts/root_inode_refs.go
+++ b/pkg/sentry/fsimpl/devpts/root_inode_refs.go
@@ -2,11 +2,10 @@ package devpts
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/fuse/inode_refs.go b/pkg/sentry/fsimpl/fuse/inode_refs.go
index 12e7d6e6c..4fb4d4da7 100644
--- a/pkg/sentry/fsimpl/fuse/inode_refs.go
+++ b/pkg/sentry/fsimpl/fuse/inode_refs.go
@@ -2,11 +2,10 @@ package fuse
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/host/connected_endpoint_refs.go b/pkg/sentry/fsimpl/host/connected_endpoint_refs.go
index 7fa5a516d..225f59782 100644
--- a/pkg/sentry/fsimpl/host/connected_endpoint_refs.go
+++ b/pkg/sentry/fsimpl/host/connected_endpoint_refs.go
@@ -2,11 +2,10 @@ package host
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/host/inode_refs.go b/pkg/sentry/fsimpl/host/inode_refs.go
index c294b8b80..4075eae17 100644
--- a/pkg/sentry/fsimpl/host/inode_refs.go
+++ b/pkg/sentry/fsimpl/host/inode_refs.go
@@ -2,11 +2,10 @@ package host
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/kernfs/dentry_refs.go b/pkg/sentry/fsimpl/kernfs/dentry_refs.go
index dd5325635..f99d4941a 100644
--- a/pkg/sentry/fsimpl/kernfs/dentry_refs.go
+++ b/pkg/sentry/fsimpl/kernfs/dentry_refs.go
@@ -2,11 +2,10 @@ package kernfs
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/kernfs/static_directory_refs.go b/pkg/sentry/fsimpl/kernfs/static_directory_refs.go
index 80513f6aa..2b258010e 100644
--- a/pkg/sentry/fsimpl/kernfs/static_directory_refs.go
+++ b/pkg/sentry/fsimpl/kernfs/static_directory_refs.go
@@ -2,11 +2,10 @@ package kernfs
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/proc/fd_dir_inode_refs.go b/pkg/sentry/fsimpl/proc/fd_dir_inode_refs.go
index 8ed286c46..467c32752 100644
--- a/pkg/sentry/fsimpl/proc/fd_dir_inode_refs.go
+++ b/pkg/sentry/fsimpl/proc/fd_dir_inode_refs.go
@@ -2,11 +2,10 @@ package proc
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/proc/fd_info_dir_inode_refs.go b/pkg/sentry/fsimpl/proc/fd_info_dir_inode_refs.go
index 957c6a6dd..3fcda0948 100644
--- a/pkg/sentry/fsimpl/proc/fd_info_dir_inode_refs.go
+++ b/pkg/sentry/fsimpl/proc/fd_info_dir_inode_refs.go
@@ -2,11 +2,10 @@ package proc
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/proc/subtasks_inode_refs.go b/pkg/sentry/fsimpl/proc/subtasks_inode_refs.go
index a80ec9e0a..2da6801c2 100644
--- a/pkg/sentry/fsimpl/proc/subtasks_inode_refs.go
+++ b/pkg/sentry/fsimpl/proc/subtasks_inode_refs.go
@@ -2,11 +2,10 @@ package proc
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/proc/task_inode_refs.go b/pkg/sentry/fsimpl/proc/task_inode_refs.go
index c4835cbca..b6e19844c 100644
--- a/pkg/sentry/fsimpl/proc/task_inode_refs.go
+++ b/pkg/sentry/fsimpl/proc/task_inode_refs.go
@@ -2,11 +2,10 @@ package proc
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/proc/tasks_inode_refs.go b/pkg/sentry/fsimpl/proc/tasks_inode_refs.go
index 5dfb34238..6207364e4 100644
--- a/pkg/sentry/fsimpl/proc/tasks_inode_refs.go
+++ b/pkg/sentry/fsimpl/proc/tasks_inode_refs.go
@@ -2,11 +2,10 @@ package proc
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/sys/dir_refs.go b/pkg/sentry/fsimpl/sys/dir_refs.go
index c05154e2b..9d15d4c80 100644
--- a/pkg/sentry/fsimpl/sys/dir_refs.go
+++ b/pkg/sentry/fsimpl/sys/dir_refs.go
@@ -2,11 +2,10 @@ package sys
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/fsimpl/tmpfs/inode_refs.go b/pkg/sentry/fsimpl/tmpfs/inode_refs.go
index 38cc30981..ff5e99c52 100644
--- a/pkg/sentry/fsimpl/tmpfs/inode_refs.go
+++ b/pkg/sentry/fsimpl/tmpfs/inode_refs.go
@@ -2,11 +2,10 @@ package tmpfs
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go b/pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go
index 2c76bf792..e7892288b 100644
--- a/pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go
+++ b/pkg/sentry/kernel/auth/auth_abi_autogen_unsafe.go
@@ -52,7 +52,7 @@ func (u *UID) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (u *UID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (u *UID) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -60,7 +60,7 @@ func (u *UID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, er
hdr.Len = u.SizeBytes()
hdr.Cap = u.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that u
// must live until the use above.
runtime.KeepAlive(u) // escapes: replaced by intrinsic.
@@ -69,13 +69,13 @@ func (u *UID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, er
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (u *UID) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return u.CopyOutN(task, addr, u.SizeBytes())
+func (u *UID) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return u.CopyOutN(cc, addr, u.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (u *UID) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (u *UID) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -83,7 +83,7 @@ func (u *UID) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = u.SizeBytes()
hdr.Cap = u.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that u
// must live until the use above.
runtime.KeepAlive(u) // escapes: replaced by intrinsic.
@@ -141,7 +141,7 @@ func (g *GID) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (g *GID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (g *GID) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -149,7 +149,7 @@ func (g *GID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, er
hdr.Len = g.SizeBytes()
hdr.Cap = g.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that g
// must live until the use above.
runtime.KeepAlive(g) // escapes: replaced by intrinsic.
@@ -158,13 +158,13 @@ func (g *GID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, er
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (g *GID) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return g.CopyOutN(task, addr, g.SizeBytes())
+func (g *GID) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return g.CopyOutN(cc, addr, g.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (g *GID) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (g *GID) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -172,7 +172,7 @@ func (g *GID) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = g.SizeBytes()
hdr.Cap = g.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that g
// must live until the use above.
runtime.KeepAlive(g) // escapes: replaced by intrinsic.
@@ -197,7 +197,7 @@ func (g *GID) WriteTo(w io.Writer) (int64, error) {
// CopyGIDSliceIn copies in a slice of GID objects from the task's memory.
//go:nosplit
-func CopyGIDSliceIn(task marshal.Task, addr usermem.Addr, dst []GID) (int, error) {
+func CopyGIDSliceIn(cc marshal.CopyContext, addr usermem.Addr, dst []GID) (int, error) {
count := len(dst)
if count == 0 {
return 0, nil
@@ -214,7 +214,7 @@ func CopyGIDSliceIn(task marshal.Task, addr usermem.Addr, dst []GID) (int, error
hdr.Len = size * count
hdr.Cap = size * count
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that dst
// must live until the use above.
runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
@@ -223,7 +223,7 @@ func CopyGIDSliceIn(task marshal.Task, addr usermem.Addr, dst []GID) (int, error
// CopyGIDSliceOut copies a slice of GID objects to the task's memory.
//go:nosplit
-func CopyGIDSliceOut(task marshal.Task, addr usermem.Addr, src []GID) (int, error) {
+func CopyGIDSliceOut(cc marshal.CopyContext, addr usermem.Addr, src []GID) (int, error) {
count := len(src)
if count == 0 {
return 0, nil
@@ -240,7 +240,7 @@ func CopyGIDSliceOut(task marshal.Task, addr usermem.Addr, src []GID) (int, erro
hdr.Len = size * count
hdr.Cap = size * count
- length, err := task.CopyOutBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that src
// must live until the use above.
runtime.KeepAlive(src) // escapes: replaced by intrinsic.
diff --git a/pkg/sentry/kernel/fd_table_refs.go b/pkg/sentry/kernel/fd_table_refs.go
index 8973cac8a..a630289c9 100644
--- a/pkg/sentry/kernel/fd_table_refs.go
+++ b/pkg/sentry/kernel/fd_table_refs.go
@@ -2,11 +2,10 @@ package kernel
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/kernel/fs_context_refs.go b/pkg/sentry/kernel/fs_context_refs.go
index c0e01dbb3..e8bb1e6ee 100644
--- a/pkg/sentry/kernel/fs_context_refs.go
+++ b/pkg/sentry/kernel/fs_context_refs.go
@@ -2,11 +2,10 @@ package kernel
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/kernel/kernel_abi_autogen_unsafe.go b/pkg/sentry/kernel/kernel_abi_autogen_unsafe.go
index c8945fb0e..eaa2ebdb3 100644
--- a/pkg/sentry/kernel/kernel_abi_autogen_unsafe.go
+++ b/pkg/sentry/kernel/kernel_abi_autogen_unsafe.go
@@ -51,7 +51,7 @@ func (t *ThreadID) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (t *ThreadID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (t *ThreadID) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -59,7 +59,7 @@ func (t *ThreadID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (in
hdr.Len = t.SizeBytes()
hdr.Cap = t.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that t
// must live until the use above.
runtime.KeepAlive(t) // escapes: replaced by intrinsic.
@@ -68,13 +68,13 @@ func (t *ThreadID) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (in
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (t *ThreadID) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return t.CopyOutN(task, addr, t.SizeBytes())
+func (t *ThreadID) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return t.CopyOutN(cc, addr, t.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (t *ThreadID) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (t *ThreadID) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -82,7 +82,7 @@ func (t *ThreadID) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = t.SizeBytes()
hdr.Cap = t.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that t
// must live until the use above.
runtime.KeepAlive(t) // escapes: replaced by intrinsic.
diff --git a/pkg/sentry/kernel/process_group_refs.go b/pkg/sentry/kernel/process_group_refs.go
index 5ff83ab96..4b257d548 100644
--- a/pkg/sentry/kernel/process_group_refs.go
+++ b/pkg/sentry/kernel/process_group_refs.go
@@ -2,11 +2,10 @@ package kernel
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go b/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go
index a0f2fe45c..90148bbb2 100644
--- a/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go
+++ b/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go
@@ -1,12 +1,12 @@
package kernel
import (
- "unsafe"
-
"fmt"
- "gvisor.dev/gvisor/pkg/sync"
"reflect"
"strings"
+ "unsafe"
+
+ "gvisor.dev/gvisor/pkg/sync"
)
// SeqAtomicLoad returns a copy of *ptr, ensuring that the read does not race
diff --git a/pkg/sentry/kernel/session_refs.go b/pkg/sentry/kernel/session_refs.go
index 9c51eda6c..204fdd060 100644
--- a/pkg/sentry/kernel/session_refs.go
+++ b/pkg/sentry/kernel/session_refs.go
@@ -2,11 +2,10 @@ package kernel
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/kernel/shm/shm_refs.go b/pkg/sentry/kernel/shm/shm_refs.go
index 0da23fa5f..4bffdd0b3 100644
--- a/pkg/sentry/kernel/shm/shm_refs.go
+++ b/pkg/sentry/kernel/shm/shm_refs.go
@@ -2,11 +2,10 @@ package shm
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/kernel/task_usermem.go b/pkg/sentry/kernel/task_usermem.go
index 14d765af1..ce134bf54 100644
--- a/pkg/sentry/kernel/task_usermem.go
+++ b/pkg/sentry/kernel/task_usermem.go
@@ -18,6 +18,7 @@ import (
"math"
"gvisor.dev/gvisor/pkg/abi/linux"
+ "gvisor.dev/gvisor/pkg/marshal"
"gvisor.dev/gvisor/pkg/syserror"
"gvisor.dev/gvisor/pkg/usermem"
)
@@ -280,29 +281,29 @@ func (t *Task) IovecsIOSequence(addr usermem.Addr, iovcnt int, opts usermem.IOOp
}, nil
}
-// CopyContext wraps a task to allow copying memory to and from the
-// task memory with user specified usermem.IOOpts.
-type CopyContext struct {
+// copyContext implements marshal.CopyContext. It wraps a task to allow copying
+// memory to and from the task memory with custom usermem.IOOpts.
+type copyContext struct {
*Task
opts usermem.IOOpts
}
// AsCopyContext wraps the task and returns it as CopyContext.
-func (t *Task) AsCopyContext(opts usermem.IOOpts) *CopyContext {
- return &CopyContext{t, opts}
+func (t *Task) AsCopyContext(opts usermem.IOOpts) marshal.CopyContext {
+ return &copyContext{t, opts}
}
// CopyInString copies a string in from the task's memory.
-func (t *CopyContext) CopyInString(addr usermem.Addr, maxLen int) (string, error) {
+func (t *copyContext) CopyInString(addr usermem.Addr, maxLen int) (string, error) {
return usermem.CopyStringIn(t, t.MemoryManager(), addr, maxLen, t.opts)
}
// CopyInBytes copies task memory into dst from an IO context.
-func (t *CopyContext) CopyInBytes(addr usermem.Addr, dst []byte) (int, error) {
+func (t *copyContext) CopyInBytes(addr usermem.Addr, dst []byte) (int, error) {
return t.MemoryManager().CopyIn(t, addr, dst, t.opts)
}
// CopyOutBytes copies src into task memoryfrom an IO context.
-func (t *CopyContext) CopyOutBytes(addr usermem.Addr, src []byte) (int, error) {
+func (t *copyContext) CopyOutBytes(addr usermem.Addr, src []byte) (int, error) {
return t.MemoryManager().CopyOut(t, addr, src, t.opts)
}
diff --git a/pkg/sentry/mm/aio_mappable_refs.go b/pkg/sentry/mm/aio_mappable_refs.go
index c80c56d94..141747137 100644
--- a/pkg/sentry/mm/aio_mappable_refs.go
+++ b/pkg/sentry/mm/aio_mappable_refs.go
@@ -2,11 +2,10 @@ package mm
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/mm/special_mappable_refs.go b/pkg/sentry/mm/special_mappable_refs.go
index 5eb7e69e0..0921a5d18 100644
--- a/pkg/sentry/mm/special_mappable_refs.go
+++ b/pkg/sentry/mm/special_mappable_refs.go
@@ -2,11 +2,10 @@ package mm
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/platform/ring0/defs_impl_arm64.go b/pkg/sentry/platform/ring0/defs_impl_arm64.go
index 424b66f76..eda1e1484 100644
--- a/pkg/sentry/platform/ring0/defs_impl_arm64.go
+++ b/pkg/sentry/platform/ring0/defs_impl_arm64.go
@@ -1,13 +1,13 @@
package ring0
import (
+ "fmt"
"gvisor.dev/gvisor/pkg/sentry/arch"
"gvisor.dev/gvisor/pkg/sentry/platform/ring0/pagetables"
-
- "fmt"
- "gvisor.dev/gvisor/pkg/usermem"
"io"
"reflect"
+
+ "gvisor.dev/gvisor/pkg/usermem"
)
// Useful bits.
diff --git a/pkg/sentry/socket/unix/socket_refs.go b/pkg/sentry/socket/unix/socket_refs.go
index 680ea06cd..39aaedc7f 100644
--- a/pkg/sentry/socket/unix/socket_refs.go
+++ b/pkg/sentry/socket/unix/socket_refs.go
@@ -2,11 +2,10 @@ package unix
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/socket/unix/transport/queue_refs.go b/pkg/sentry/socket/unix/transport/queue_refs.go
index 17951eb2f..4c3dcd13f 100644
--- a/pkg/sentry/socket/unix/transport/queue_refs.go
+++ b/pkg/sentry/socket/unix/transport/queue_refs.go
@@ -2,11 +2,10 @@ package transport
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go b/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go
index cd7afb24f..55b5bc248 100644
--- a/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go
+++ b/pkg/sentry/syscalls/linux/linux_abi_autogen_unsafe.go
@@ -67,25 +67,25 @@ func (o *oldDirentHdr) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (o *oldDirentHdr) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (o *oldDirentHdr) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Type oldDirentHdr doesn't have a packed layout in memory, fall back to MarshalBytes.
- buf := task.CopyScratchBuffer(o.SizeBytes()) // escapes: okay.
+ buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay.
o.MarshalBytes(buf) // escapes: fallback.
- return task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
}
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (o *oldDirentHdr) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return o.CopyOutN(task, addr, o.SizeBytes())
+func (o *oldDirentHdr) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return o.CopyOutN(cc, addr, o.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (o *oldDirentHdr) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (o *oldDirentHdr) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Type oldDirentHdr doesn't have a packed layout in memory, fall back to UnmarshalBytes.
- buf := task.CopyScratchBuffer(o.SizeBytes()) // escapes: okay.
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Unmarshal unconditionally. If we had a short copy-in, this results in a
// partially unmarshalled struct.
o.UnmarshalBytes(buf) // escapes: fallback.
@@ -143,25 +143,25 @@ func (d *direntHdr) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (d *direntHdr) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (d *direntHdr) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Type direntHdr doesn't have a packed layout in memory, fall back to MarshalBytes.
- buf := task.CopyScratchBuffer(d.SizeBytes()) // escapes: okay.
+ buf := cc.CopyScratchBuffer(d.SizeBytes()) // escapes: okay.
d.MarshalBytes(buf) // escapes: fallback.
- return task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
}
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (d *direntHdr) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return d.CopyOutN(task, addr, d.SizeBytes())
+func (d *direntHdr) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return d.CopyOutN(cc, addr, d.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (d *direntHdr) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (d *direntHdr) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Type direntHdr doesn't have a packed layout in memory, fall back to UnmarshalBytes.
- buf := task.CopyScratchBuffer(d.SizeBytes()) // escapes: okay.
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ buf := cc.CopyScratchBuffer(d.SizeBytes()) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Unmarshal unconditionally. If we had a short copy-in, this results in a
// partially unmarshalled struct.
d.UnmarshalBytes(buf) // escapes: fallback.
@@ -216,7 +216,7 @@ func (r *rlimit64) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (r *rlimit64) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (r *rlimit64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -224,7 +224,7 @@ func (r *rlimit64) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (in
hdr.Len = r.SizeBytes()
hdr.Cap = r.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that r
// must live until the use above.
runtime.KeepAlive(r) // escapes: replaced by intrinsic.
@@ -233,13 +233,13 @@ func (r *rlimit64) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (in
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (r *rlimit64) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return r.CopyOutN(task, addr, r.SizeBytes())
+func (r *rlimit64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return r.CopyOutN(cc, addr, r.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (r *rlimit64) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (r *rlimit64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -247,7 +247,7 @@ func (r *rlimit64) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = r.SizeBytes()
hdr.Cap = r.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that r
// must live until the use above.
runtime.KeepAlive(r) // escapes: replaced by intrinsic.
@@ -305,7 +305,7 @@ func (s *SchedParam) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (s *SchedParam) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (s *SchedParam) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -313,7 +313,7 @@ func (s *SchedParam) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -322,13 +322,13 @@ func (s *SchedParam) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (s *SchedParam) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return s.CopyOutN(task, addr, s.SizeBytes())
+func (s *SchedParam) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return s.CopyOutN(cc, addr, s.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (s *SchedParam) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (s *SchedParam) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -336,7 +336,7 @@ func (s *SchedParam) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -403,7 +403,7 @@ func (u *userSockFprog) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (u *userSockFprog) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (u *userSockFprog) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -411,7 +411,7 @@ func (u *userSockFprog) CopyOutN(task marshal.Task, addr usermem.Addr, limit int
hdr.Len = u.SizeBytes()
hdr.Cap = u.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that u
// must live until the use above.
runtime.KeepAlive(u) // escapes: replaced by intrinsic.
@@ -420,13 +420,13 @@ func (u *userSockFprog) CopyOutN(task marshal.Task, addr usermem.Addr, limit int
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (u *userSockFprog) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return u.CopyOutN(task, addr, u.SizeBytes())
+func (u *userSockFprog) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return u.CopyOutN(cc, addr, u.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (u *userSockFprog) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (u *userSockFprog) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -434,7 +434,7 @@ func (u *userSockFprog) CopyIn(task marshal.Task, addr usermem.Addr) (int, error
hdr.Len = u.SizeBytes()
hdr.Cap = u.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that u
// must live until the use above.
runtime.KeepAlive(u) // escapes: replaced by intrinsic.
@@ -524,7 +524,7 @@ func (m *MessageHeader64) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (m *MessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (m *MessageHeader64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -532,7 +532,7 @@ func (m *MessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr, limit i
hdr.Len = m.SizeBytes()
hdr.Cap = m.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that m
// must live until the use above.
runtime.KeepAlive(m) // escapes: replaced by intrinsic.
@@ -541,13 +541,13 @@ func (m *MessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr, limit i
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (m *MessageHeader64) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return m.CopyOutN(task, addr, m.SizeBytes())
+func (m *MessageHeader64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return m.CopyOutN(cc, addr, m.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (m *MessageHeader64) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (m *MessageHeader64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -555,7 +555,7 @@ func (m *MessageHeader64) CopyIn(task marshal.Task, addr usermem.Addr) (int, err
hdr.Len = m.SizeBytes()
hdr.Cap = m.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that m
// must live until the use above.
runtime.KeepAlive(m) // escapes: replaced by intrinsic.
@@ -632,12 +632,12 @@ func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (m *multipleMessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (m *multipleMessageHeader64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
if !m.msgHdr.Packed() {
// Type multipleMessageHeader64 doesn't have a packed layout in memory, fall back to MarshalBytes.
- buf := task.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
+ buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
m.MarshalBytes(buf) // escapes: fallback.
- return task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
}
// Construct a slice backed by dst's underlying memory.
@@ -647,7 +647,7 @@ func (m *multipleMessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr,
hdr.Len = m.SizeBytes()
hdr.Cap = m.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that m
// must live until the use above.
runtime.KeepAlive(m) // escapes: replaced by intrinsic.
@@ -656,17 +656,17 @@ func (m *multipleMessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr,
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (m *multipleMessageHeader64) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return m.CopyOutN(task, addr, m.SizeBytes())
+func (m *multipleMessageHeader64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return m.CopyOutN(cc, addr, m.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (m *multipleMessageHeader64) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (m *multipleMessageHeader64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
if !m.msgHdr.Packed() {
// Type multipleMessageHeader64 doesn't have a packed layout in memory, fall back to UnmarshalBytes.
- buf := task.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Unmarshal unconditionally. If we had a short copy-in, this results in a
// partially unmarshalled struct.
m.UnmarshalBytes(buf) // escapes: fallback.
@@ -680,7 +680,7 @@ func (m *multipleMessageHeader64) CopyIn(task marshal.Task, addr usermem.Addr) (
hdr.Len = m.SizeBytes()
hdr.Cap = m.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that m
// must live until the use above.
runtime.KeepAlive(m) // escapes: replaced by intrinsic.
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 434631c74..ccd56285a 100644
--- a/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go
+++ b/pkg/sentry/syscalls/linux/vfs2/vfs2_abi_autogen_unsafe.go
@@ -57,7 +57,7 @@ func (s *sigSetWithSize) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (s *sigSetWithSize) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (s *sigSetWithSize) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -65,7 +65,7 @@ func (s *sigSetWithSize) CopyOutN(task marshal.Task, addr usermem.Addr, limit in
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -74,13 +74,13 @@ func (s *sigSetWithSize) CopyOutN(task marshal.Task, addr usermem.Addr, limit in
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (s *sigSetWithSize) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return s.CopyOutN(task, addr, s.SizeBytes())
+func (s *sigSetWithSize) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return s.CopyOutN(cc, addr, s.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (s *sigSetWithSize) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (s *sigSetWithSize) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -88,7 +88,7 @@ func (s *sigSetWithSize) CopyIn(task marshal.Task, addr usermem.Addr) (int, erro
hdr.Len = s.SizeBytes()
hdr.Cap = s.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that s
// must live until the use above.
runtime.KeepAlive(s) // escapes: replaced by intrinsic.
@@ -178,7 +178,7 @@ func (m *MessageHeader64) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (m *MessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (m *MessageHeader64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -186,7 +186,7 @@ func (m *MessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr, limit i
hdr.Len = m.SizeBytes()
hdr.Cap = m.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that m
// must live until the use above.
runtime.KeepAlive(m) // escapes: replaced by intrinsic.
@@ -195,13 +195,13 @@ func (m *MessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr, limit i
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (m *MessageHeader64) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return m.CopyOutN(task, addr, m.SizeBytes())
+func (m *MessageHeader64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return m.CopyOutN(cc, addr, m.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (m *MessageHeader64) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (m *MessageHeader64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
// Construct a slice backed by dst's underlying memory.
var buf []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
@@ -209,7 +209,7 @@ func (m *MessageHeader64) CopyIn(task marshal.Task, addr usermem.Addr) (int, err
hdr.Len = m.SizeBytes()
hdr.Cap = m.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that m
// must live until the use above.
runtime.KeepAlive(m) // escapes: replaced by intrinsic.
@@ -286,12 +286,12 @@ func (m *multipleMessageHeader64) UnmarshalUnsafe(src []byte) {
// CopyOutN implements marshal.Marshallable.CopyOutN.
//go:nosplit
-func (m *multipleMessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr, limit int) (int, error) {
+func (m *multipleMessageHeader64) CopyOutN(cc marshal.CopyContext, addr usermem.Addr, limit int) (int, error) {
if !m.msgHdr.Packed() {
// Type multipleMessageHeader64 doesn't have a packed layout in memory, fall back to MarshalBytes.
- buf := task.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
+ buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
m.MarshalBytes(buf) // escapes: fallback.
- return task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
}
// Construct a slice backed by dst's underlying memory.
@@ -301,7 +301,7 @@ func (m *multipleMessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr,
hdr.Len = m.SizeBytes()
hdr.Cap = m.SizeBytes()
- length, err := task.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
+ length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that m
// must live until the use above.
runtime.KeepAlive(m) // escapes: replaced by intrinsic.
@@ -310,17 +310,17 @@ func (m *multipleMessageHeader64) CopyOutN(task marshal.Task, addr usermem.Addr,
// CopyOut implements marshal.Marshallable.CopyOut.
//go:nosplit
-func (m *multipleMessageHeader64) CopyOut(task marshal.Task, addr usermem.Addr) (int, error) {
- return m.CopyOutN(task, addr, m.SizeBytes())
+func (m *multipleMessageHeader64) CopyOut(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
+ return m.CopyOutN(cc, addr, m.SizeBytes())
}
// CopyIn implements marshal.Marshallable.CopyIn.
//go:nosplit
-func (m *multipleMessageHeader64) CopyIn(task marshal.Task, addr usermem.Addr) (int, error) {
+func (m *multipleMessageHeader64) CopyIn(cc marshal.CopyContext, addr usermem.Addr) (int, error) {
if !m.msgHdr.Packed() {
// Type multipleMessageHeader64 doesn't have a packed layout in memory, fall back to UnmarshalBytes.
- buf := task.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Unmarshal unconditionally. If we had a short copy-in, this results in a
// partially unmarshalled struct.
m.UnmarshalBytes(buf) // escapes: fallback.
@@ -334,7 +334,7 @@ func (m *multipleMessageHeader64) CopyIn(task marshal.Task, addr usermem.Addr) (
hdr.Len = m.SizeBytes()
hdr.Cap = m.SizeBytes()
- length, err := task.CopyInBytes(addr, buf) // escapes: okay.
+ length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
// Since we bypassed the compiler's escape analysis, indicate that m
// must live until the use above.
runtime.KeepAlive(m) // escapes: replaced by intrinsic.
diff --git a/pkg/sentry/time/seqatomic_parameters_unsafe.go b/pkg/sentry/time/seqatomic_parameters_unsafe.go
index f18440378..2cb001080 100644
--- a/pkg/sentry/time/seqatomic_parameters_unsafe.go
+++ b/pkg/sentry/time/seqatomic_parameters_unsafe.go
@@ -1,12 +1,12 @@
package time
import (
- "unsafe"
-
"fmt"
- "gvisor.dev/gvisor/pkg/sync"
"reflect"
"strings"
+ "unsafe"
+
+ "gvisor.dev/gvisor/pkg/sync"
)
// SeqAtomicLoad returns a copy of *ptr, ensuring that the read does not race
diff --git a/pkg/sentry/vfs/file_description_refs.go b/pkg/sentry/vfs/file_description_refs.go
index 5e612d7f0..6c7747259 100644
--- a/pkg/sentry/vfs/file_description_refs.go
+++ b/pkg/sentry/vfs/file_description_refs.go
@@ -2,11 +2,10 @@ package vfs
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/vfs/filesystem_refs.go b/pkg/sentry/vfs/filesystem_refs.go
index aaa753c43..96f681831 100644
--- a/pkg/sentry/vfs/filesystem_refs.go
+++ b/pkg/sentry/vfs/filesystem_refs.go
@@ -2,11 +2,10 @@ package vfs
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so
diff --git a/pkg/sentry/vfs/mount_namespace_refs.go b/pkg/sentry/vfs/mount_namespace_refs.go
index 56b8d9903..4c422c81f 100644
--- a/pkg/sentry/vfs/mount_namespace_refs.go
+++ b/pkg/sentry/vfs/mount_namespace_refs.go
@@ -2,11 +2,10 @@ package vfs
import (
"fmt"
+ "gvisor.dev/gvisor/pkg/log"
refs_vfs1 "gvisor.dev/gvisor/pkg/refs"
"runtime"
"sync/atomic"
-
- "gvisor.dev/gvisor/pkg/log"
)
// ownerType is used to customize logging. Note that we use a pointer to T so