fuse: use safe go_marshal API for FUSE

Until #3698 is resolved, this change is needed to ensure we're not
corrupting memory anywhere.
This commit is contained in:
Ridwan Sharif
2020-09-16 12:19:30 -07:00
committed by Andrei Vagin
parent 4a5857d644
commit d51ddcefdc
3 changed files with 103 additions and 5 deletions
+6 -3
View File
@@ -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
}