summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/fsutil/file.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-09-16 19:16:48 +0000
committergVisor bot <gvisor-bot@google.com>2021-09-16 19:16:48 +0000
commitbe409c70b26dc5655f157692f253262df9b7553f (patch)
treeb60e633dde4f7e1cd543c1d67a4a55a5d1570850 /pkg/sentry/fs/fsutil/file.go
parente73986dd376c2c71d81ab8ccabdea3aecac5e9d5 (diff)
parent51b96514cd9397870b39506e3693017a355319dd (diff)
Merge release-20210906.0-35-g51b96514c (automated)
Diffstat (limited to 'pkg/sentry/fs/fsutil/file.go')
-rw-r--r--pkg/sentry/fs/fsutil/file.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/fs/fsutil/file.go b/pkg/sentry/fs/fsutil/file.go
index 3ece73b81..38e3ed42d 100644
--- a/pkg/sentry/fs/fsutil/file.go
+++ b/pkg/sentry/fs/fsutil/file.go
@@ -16,6 +16,7 @@ package fsutil
import (
"io"
+ "math"
"gvisor.dev/gvisor/pkg/context"
"gvisor.dev/gvisor/pkg/errors/linuxerr"
@@ -210,6 +211,9 @@ func (FileNoMMap) ConfigureMMap(context.Context, *fs.File, *memmap.MMapOpts) err
// GenericConfigureMMap implements fs.FileOperations.ConfigureMMap for most
// filesystems that support memory mapping.
func GenericConfigureMMap(file *fs.File, m memmap.Mappable, opts *memmap.MMapOpts) error {
+ if opts.Offset+opts.Length > math.MaxInt64 {
+ return linuxerr.EOVERFLOW
+ }
opts.Mappable = m
opts.MappingIdentity = file
file.IncRef()