diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-01-31 12:53:00 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-01-31 12:54:00 -0800 |
commit | a497f5ed5f97e4ad49ed60dd46f0146ae45eefd6 (patch) | |
tree | 8673e58e90036bc078eca13b548db123ae0a0c12 /pkg/sentry/fs/gofer/file.go | |
parent | f1c1ee8a8ea6c0035aa799af3d7f5733fa2275d0 (diff) |
Invalidate COW mappings when file is truncated
This changed required making fsutil.HostMappable use
a backing file to ensure the correct FD would be used
for read/write operations.
RELNOTES: relnotes is needed for the parent CL.
PiperOrigin-RevId: 231836164
Change-Id: I8ae9639715529874ea7d80a65e2c711a5b4ce254
Diffstat (limited to 'pkg/sentry/fs/gofer/file.go')
-rw-r--r-- | pkg/sentry/fs/gofer/file.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/sentry/fs/gofer/file.go b/pkg/sentry/fs/gofer/file.go index 2181ddc68..2bb25daf1 100644 --- a/pkg/sentry/fs/gofer/file.go +++ b/pkg/sentry/fs/gofer/file.go @@ -215,6 +215,9 @@ func (f *fileOperations) Write(ctx context.Context, file *fs.File, src usermem.I } return n, err } + if f.inodeOperations.fileState.hostMappable != nil { + return f.inodeOperations.fileState.hostMappable.Write(ctx, src, offset) + } return src.CopyInTo(ctx, f.handles.readWriterAt(ctx, offset)) } |