diff options
| author | Julia Hansbrough <flowerhack@google.com> | 2018-05-01 14:34:00 -0700 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-05-03 07:50:03 +0200 |
| commit | 9ce14f4b01504ed4106711290601e09423a42413 (patch) | |
| tree | 6268c7496aba90bb5061c1e090b942a5b350e3c6 /prog/resources.go | |
| parent | d5b114b4015bcfb0ea2724efc01f478f6ea96b4f (diff) | |
prog: Fix page fault for syz-stress users.
In resources.go, haveGettime is False when SyscallMap["clock_gettime"]
is nil.
In this code, there's a branch that's entered only if Gettime is False,
which appends SyscallMap["clock_gettime"] to resourceCtors. That is, it
appends nil to resourceCtors, then iterates through resourceCtors and
tries to dereference the .Name of each time, in this case, nil.Name.
This was causing a page fault on Fuchsia.
I'm not certain how the "standard" flow is supposed to work, since it
seems like any code that enters the `if cantCreate == "" && !haveGettime`
should fail... but, removing that section causes test failures, so let's
just enforce that SyscallMap["clock_gettime"] is non-nil.
If there's a better way to solve this, I'm open to suggestions.
Diffstat (limited to 'prog/resources.go')
| -rw-r--r-- | prog/resources.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/prog/resources.go b/prog/resources.go index 33c497d5a..81a02e9ca 100644 --- a/prog/resources.go +++ b/prog/resources.go @@ -125,7 +125,7 @@ func (target *Target) TransitivelyEnabledCalls(enabled map[*Syscall]bool) (map[* } // We need to support structs as resources, // but for now we just special-case timespec/timeval. - if cantCreate == "" && !haveGettime { + if cantCreate == "" && !haveGettime && target.SyscallMap["clock_gettime"] != nil { ForeachType(c, func(typ Type) { if a, ok := typ.(*StructType); ok && a.Dir() != DirOut && (a.Name() == "timespec" || a.Name() == "timeval") { cantCreate = a.Name() |
