diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2020-08-13 19:31:17 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-13 19:33:56 -0700 |
commit | d6520e1d0592f99161faedef3eba49439b140917 (patch) | |
tree | 302e0b765424bbcb46315b045b40fd707c3645d0 /pkg/memutil | |
parent | d3bb50ebf85c1241ec91745eaca9fbbb86eb4211 (diff) |
[vfs2][gofer] Fix file creation flags sent to gofer.
Fixes php runtime test ext/standard/tests/file/readfile_basic.phpt
Fixes #3516
fsgofers only want the access mode in the OpenFlags passed to Create(). If more
flags are supplied (like O_APPEND in this case), read/write from that fd will
fail with EBADF. See runsc/fsgofer/fsgofer.go:WriteAt()
VFS2 was providing more than just access modes. So filtering the flags using
p9.OpenFlagsModeMask == linux.O_ACCMODE fixes the issue.
Gofer in VFS1 also only extracts the access mode flags while making the create
RPC. See pkg/sentry/fs/gofer/path.go:Create()
Even in VFS2, when we open a handle, we extract out only the access mode flags
+ O_TRUNC.
See third_party/gvisor/pkg/sentry/fsimpl/gofer/handle.go:openHandle()
Added a test for this.
PiperOrigin-RevId: 326574829
Diffstat (limited to 'pkg/memutil')
0 files changed, 0 insertions, 0 deletions