diff options
author | Jamie Liu <jamieliu@google.com> | 2020-10-13 12:43:03 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-13 12:45:51 -0700 |
commit | 1a6948737323436ff5925f2e092fcbbce429deb3 (patch) | |
tree | f50913d5232a19b3d7f127f04926467a168a885c /pkg/iovec/iovec_state_autogen.go | |
parent | 7053f17859d6905408b8f724e89711910851eb1b (diff) |
Don't read beyond EOF when inserting into sentry page cache.
The sentry page cache stores file contents at page granularity; this is
necessary for memory mappings. Thus file offset ranges passed to
fsutil.FileRangeSet.Fill() must be page-aligned. If the read callback passed to
Fill() returns (partial read, nil error) when reading up to EOF (which is the
case for p9.ClientFile.ReadAt() since 9P's Rread cannot convey both a partial
read and EOF), Fill() will re-invoke the read callback to try to read from EOF
to the end of the containing page, which is harmless but needlessly expensive.
Fix this by handling file size explicitly in fsutil.FileRangeSet.Fill().
PiperOrigin-RevId: 336934075
Diffstat (limited to 'pkg/iovec/iovec_state_autogen.go')
0 files changed, 0 insertions, 0 deletions