summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl
diff options
context:
space:
mode:
authorRidwan Sharif <ridwanmsharif@google.com>2020-08-19 20:11:59 -0400
committerAndrei Vagin <avagin@gmail.com>2020-09-11 13:35:25 -0700
commit0f2a8b08f13cc39d924c328bc7a9bab73c1c2328 (patch)
tree511869e6090717b68f2423a6e329a3a199e39d7d /pkg/sentry/fsimpl
parenteccdd440899113c229f4abea53c03364d7f9875c (diff)
fuse: use safe go_marshal API for FUSE
Until #3698 is resolved, this change is needed to ensure we're not corrupting memory anywhere.
Diffstat (limited to 'pkg/sentry/fsimpl')
-rw-r--r--pkg/sentry/fsimpl/fuse/connection.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/sentry/fsimpl/fuse/connection.go b/pkg/sentry/fsimpl/fuse/connection.go
index f1a5c2ecb..f7d1a5c52 100644
--- a/pkg/sentry/fsimpl/fuse/connection.go
+++ b/pkg/sentry/fsimpl/fuse/connection.go
@@ -270,8 +270,10 @@ func (conn *connection) NewRequest(creds *auth.Credentials, pid uint32, ino uint
}
buf := make([]byte, hdr.Len)
- hdr.MarshalUnsafe(buf[:hdrLen])
- payload.MarshalUnsafe(buf[hdrLen:])
+
+ // TODO(gVisor.dev/3698): Use the unsafe version once go_marshal is safe to use again.
+ hdr.MarshalBytes(buf[:hdrLen])
+ payload.MarshalBytes(buf[hdrLen:])
return &Request{
id: hdr.Unique,
@@ -359,7 +361,8 @@ func (r *Response) UnmarshalPayload(m marshal.Marshallable) error {
return nil
}
- m.UnmarshalUnsafe(r.data[hdrLen:])
+ // TODO(gVisor.dev/3698): Use the unsafe version once go_marshal is safe to use again.
+ m.UnmarshalBytes(r.data[hdrLen:])
return nil
}