diff options
author | Ridwan Sharif <ridwanmsharif@google.com> | 2020-08-19 20:11:59 -0400 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2020-09-16 12:19:30 -0700 |
commit | d51ddcefdc46a1007f7345bfa2f7006bb820b157 (patch) | |
tree | 6fab64e6cc39a057d4498e5a5ed465097f58ab5c /pkg/sentry/fsimpl | |
parent | 4a5857d644ae0e62090bbbed86852dceca79395c (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.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/sentry/fsimpl/fuse/connection.go b/pkg/sentry/fsimpl/fuse/connection.go index 133306158..0e70d37ec 100644 --- a/pkg/sentry/fsimpl/fuse/connection.go +++ b/pkg/sentry/fsimpl/fuse/connection.go @@ -271,8 +271,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, @@ -360,7 +362,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 } |