diff options
author | Jamie Liu <jamieliu@google.com> | 2021-02-17 17:39:24 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-02-17 17:41:10 -0800 |
commit | f051ec64639b83faabcfe766ff078072def3c2aa (patch) | |
tree | 892c0fc2f4fd4138299c3c0d5a5836a940a670b5 /pkg/sentry/vfs | |
parent | 4bc7daf91a0d9102fa477b199964e7db45066da1 (diff) |
Add gohacks.Slice/StringHeader.
See https://github.com/golang/go/issues/19367 for rationale. Note that the
upstream decision arrived at in that thread, while useful for some of our use
cases, doesn't account for all of our SliceHeader use cases (we often use
SliceHeader to extract pointers from slices in a way that avoids bounds
checking and/or handles nil slices correctly) and also doesn't exist yet.
PiperOrigin-RevId: 358071574
Diffstat (limited to 'pkg/sentry/vfs')
-rw-r--r-- | pkg/sentry/vfs/mount_unsafe.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/sentry/vfs/mount_unsafe.go b/pkg/sentry/vfs/mount_unsafe.go index 0df023713..c7a78d8f8 100644 --- a/pkg/sentry/vfs/mount_unsafe.go +++ b/pkg/sentry/vfs/mount_unsafe.go @@ -17,7 +17,6 @@ package vfs import ( "fmt" "math/bits" - "reflect" "sync/atomic" "unsafe" @@ -153,8 +152,8 @@ func (mt *mountTable) Init() { func newMountTableSlots(cap uintptr) unsafe.Pointer { slice := make([]mountSlot, cap, cap) - hdr := (*reflect.SliceHeader)(unsafe.Pointer(&slice)) - return unsafe.Pointer(hdr.Data) + hdr := (*gohacks.SliceHeader)(unsafe.Pointer(&slice)) + return hdr.Data } // Lookup returns the Mount with the given parent, mounted at the given point. |