diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-08-19 09:46:43 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-08-19 10:16:23 +0200 |
| commit | 838e336594e410898667fa06b15f1116a3b586fd (patch) | |
| tree | 1520155493fabef45ab3b5d59f396c42f7968713 /prog/analysis.go | |
| parent | 33b9e777cbaf25d5ac727783aedddb382c97338f (diff) | |
sys, prog: switch values to to uint64
We currently use uintptr for all values.
This won't work for 32-bit archs.
Moreover in some cases we use uintptr but assume
that it is always 64-bits (e.g. in encodingexec).
Switch everything to uint64.
Update #324
Diffstat (limited to 'prog/analysis.go')
| -rw-r--r-- | prog/analysis.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/prog/analysis.go b/prog/analysis.go index a932cc253..81dc94956 100644 --- a/prog/analysis.go +++ b/prog/analysis.go @@ -99,11 +99,11 @@ func (s *state) analyze(c *Call) { func (s *state) addressable(addr *PointerArg, size *ConstArg, ok bool) { sizePages := size.Val / pageSize - if addr.PageIndex+sizePages > uintptr(len(s.pages)) { + if addr.PageIndex+sizePages > uint64(len(s.pages)) { panic(fmt.Sprintf("address is out of bounds: page=%v len=%v bound=%v\naddr: %+v\nsize: %+v", addr.PageIndex, sizePages, len(s.pages), addr, size)) } - for i := uintptr(0); i < sizePages; i++ { + for i := uint64(0); i < sizePages; i++ { s.pages[addr.PageIndex+i] = ok } } @@ -149,13 +149,13 @@ func foreachArg(c *Call, f func(arg, base Arg, parent *[]Arg)) { foreachArgArray(&c.Args, nil, f) } -func foreachSubargOffset(arg Arg, f func(arg Arg, offset uintptr)) { - var rec func(Arg, uintptr) uintptr - rec = func(arg1 Arg, offset uintptr) uintptr { +func foreachSubargOffset(arg Arg, f func(arg Arg, offset uint64)) { + var rec func(Arg, uint64) uint64 + rec = func(arg1 Arg, offset uint64) uint64 { switch a := arg1.(type) { case *GroupArg: f(arg1, offset) - var totalSize uintptr + var totalSize uint64 for _, arg2 := range a.Inner { size := rec(arg2, offset) if arg2.Type().BitfieldLength() == 0 || arg2.Type().BitfieldLast() { @@ -250,7 +250,7 @@ func sanitizeCall(c *Call) { // PTRACE_TRACEME leads to unkillable processes, see: // https://groups.google.com/forum/#!topic/syzkaller/uGzwvhlCXAw if req.Val == sys.PTRACE_TRACEME { - req.Val = ^uintptr(0) + req.Val = ^uint64(0) } case "exit", "exit_group": code := c.Args[0].(*ConstArg) |
