diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-10-16 22:20:51 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-10-16 22:20:51 +0000 |
commit | a02f8d0dbefc8a56940a579f07ac1c35be92a112 (patch) | |
tree | 8e44280b5dfecea49eca930c60bfeb4cbfe03e77 /pkg/sentry/fs/fsutil/inode_cached.go | |
parent | d8af87b44fcae3f7666005fa0e54d242c3708699 (diff) | |
parent | 9fb562234e7858dbc60e8771f851629464edf205 (diff) |
Merge release-20190806.1-281-g9fb5622 (automated)
Diffstat (limited to 'pkg/sentry/fs/fsutil/inode_cached.go')
-rw-r--r-- | pkg/sentry/fs/fsutil/inode_cached.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/pkg/sentry/fs/fsutil/inode_cached.go b/pkg/sentry/fs/fsutil/inode_cached.go index dd80757dc..798920d18 100644 --- a/pkg/sentry/fs/fsutil/inode_cached.go +++ b/pkg/sentry/fs/fsutil/inode_cached.go @@ -959,6 +959,23 @@ func (c *CachingInodeOperations) InvalidateUnsavable(ctx context.Context) error return nil } +// NotifyChangeFD must be called after the file description represented by +// CachedFileObject.FD() changes. +func (c *CachingInodeOperations) NotifyChangeFD() error { + // Update existing sentry mappings to refer to the new file description. + if err := c.hostFileMapper.RegenerateMappings(c.backingFile.FD()); err != nil { + return err + } + + // Shoot down existing application mappings of the old file description; + // they will be remapped with the new file description on demand. + c.mapsMu.Lock() + defer c.mapsMu.Unlock() + + c.mappings.InvalidateAll(memmap.InvalidateOpts{}) + return nil +} + // Evict implements pgalloc.EvictableMemoryUser.Evict. func (c *CachingInodeOperations) Evict(ctx context.Context, er pgalloc.EvictableRange) { c.mapsMu.Lock() @@ -1027,7 +1044,6 @@ func (c *CachingInodeOperations) DecRef(fr platform.FileRange) { } c.refs.MergeAdjacent(fr) c.dataMu.Unlock() - } // MapInternal implements platform.File.MapInternal. This is used when we |