Allow NULL data in mount(2)

PiperOrigin-RevId: 213315267
Change-Id: I7562bcd81fb22e90aa9c7dd9eeb94803fcb8c5af
This commit is contained in:
Michael Pratt 2018-09-17 12:15:35 -07:00 committed by Shentubot
parent 25add7b22b
commit d639c3d61b
1 changed files with 10 additions and 7 deletions

View File

@ -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.