summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2018-09-17 12:15:35 -0700
committerShentubot <shentubot@google.com>2018-09-17 12:16:29 -0700
commitd639c3d61bfdbd42eb809c21a15275cc75524b7e (patch)
tree9c2e1a9e26866181a421a0c25b1137f01926d7ec /pkg/sentry/syscalls
parent25add7b22b1b0b6a4bac1e72536d3f3a0c70f048 (diff)
Allow NULL data in mount(2)
PiperOrigin-RevId: 213315267 Change-Id: I7562bcd81fb22e90aa9c7dd9eeb94803fcb8c5af
Diffstat (limited to 'pkg/sentry/syscalls')
-rw-r--r--pkg/sentry/syscalls/linux/sys_mount.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_mount.go b/pkg/sentry/syscalls/linux/sys_mount.go
index d70b79e4f..57cedccc1 100644
--- a/pkg/sentry/syscalls/linux/sys_mount.go
+++ b/pkg/sentry/syscalls/linux/sys_mount.go
@@ -46,13 +46,16 @@ func Mount(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
return 0, nil, err
}
- // In Linux, a full page is always copied in regardless of null
- // character placement, and the address is passed to each file system.
- // Most file systems always treat this data as a string, though, and so
- // do all of the ones we implement.
- data, err := t.CopyInString(dataAddr, usermem.PageSize)
- if err != nil {
- return 0, nil, err
+ data := ""
+ if dataAddr != 0 {
+ // In Linux, a full page is always copied in regardless of null
+ // character placement, and the address is passed to each file system.
+ // Most file systems always treat this data as a string, though, and so
+ // do all of the ones we implement.
+ data, err = t.CopyInString(dataAddr, usermem.PageSize)
+ if err != nil {
+ return 0, nil, err
+ }
}
// Ignore magic value that was required before Linux 2.4.