Skip to content

Commit

Permalink
stack: Lower IsPtr() floor from 8MiB to to 4MiB
Browse files Browse the repository at this point in the history
That's frequent to have pointer lower in the address space. This was not
well tested but will be well tested in v2. This will modify stack
bucketing, generally helping in AnyPointer mode.
  • Loading branch information
maruel committed Apr 18, 2020
1 parent 05c8a99 commit 5cfac64
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions stack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,16 @@ type Arg struct {
// IsPtr returns true if we guess it's a pointer. It's only a guess, it can be
// easily be confused by a bitmask.
func (a *Arg) IsPtr() bool {
// Assumes all pointers are above 8MiB and positive; assuming that above half
// the memory is kernel memory. This is not always true.
// Assumes all values are above 4MiB and positive are pointers; assuming that
// above half the memory is kernel memory.
//
// This is not always true but this should be good enough to help
// implementing AnyPointer.
//
// Assume the stack was generated with the same bitness (32 vs 64) than the
// code processing it.
const maxInt = uint64(int((^uint(0)) >> 1))
return a.Value > 8*1024*1024 && a.Value < maxInt
const maxInt = uint64((^uint(0)) >> 1)
return a.Value > 4*1024*1024 && a.Value < maxInt
}

var lookup = []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
Expand Down

0 comments on commit 5cfac64

Please sign in to comment.