internal/gocore: ignore execute-only mappings
Currently viewcore panics when seeing an execute-only (`--xp`) mapping.
But such mappings do exist. From /proc/self/smaps in a process on one of
our machines:
ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]
This implies `vsyscall=xonly` on that host. See
https://lwn.net/Articles/790886/.
Change-Id: I9299a53cfe07332e55fd7f6bed60f4a0f222293e
Reviewed-on: https://go-review.googlesource.com/c/debug/+/618981
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
diff --git a/internal/gocore/process.go b/internal/gocore/process.go
index 73e7b99..1cd1431 100644
--- a/internal/gocore/process.go
+++ b/internal/gocore/process.go
@@ -398,6 +398,8 @@
// Any other anonymous mapping is bss.
// TODO: how to distinguish original bss from anonymous mmap?
bss += size
+ case core.Exec: // Ignore --xp mappings, like Linux's vsyscall=xonly.
+ all -= size // Make the total match again.
default:
panic("weird mapping " + m.Perm().String())
}