gvisor icon indicating copy to clipboard operation
gvisor copied to clipboard

checkescape conflates source files with the same name in different packages

Open nixprime opened this issue 1 year ago • 3 comments

Description

checkescape (//tools/checkescape) uses go tool objdump to produce a mapping from source lines to function calls at those lines (checkescape.go:loadObjdump()). However, go tool objdump only prints the basename for each source line, e.g.:

TEXT gvisor.dev/gvisor/pkg/sentry/mm.(*MemoryManager).MRemap(SB) pkg/sentry/mm/syscalls.go
  syscalls.go:348       0x8737e0                4c8da42458fcffff                LEAQ 0xfffffc58(SP), R12
...

This was discovered in the context of #9072, where checkescape confuses kernel/syscalls.go:494 (kernel.IncrementUnimplementedSyscallCounter()) for mm/syscalls.go:494 (after this change, the call to MM.findAvailableLocked() in MM.MRemap()) and emits a false positive:

arm64...checkescape: pkg/sentry/kernel/syscalls.go:494:6: stack: possible split on function entry → gvisor.dev/gvisor/pkg/sentry/mm.(*MemoryManager).findAvailableLocked (GOOARCH=arm64, GOOS=linux)
amd64...checkescape: pkg/sentry/kernel/syscalls.go:494:6: stack: possible split on function entry → gvisor.dev/gvisor/pkg/sentry/mm.(*MemoryManager).findAvailableLocked (GOOARCH=amd64, GOOS=linux)

AFAIU the cleanest fix would be to plumb a flag through go tool objdump (Go: cmd/objdump) to cmd/internal/objfile that causes objfile.Disasm.Print() to print full filenames.

Steps to reproduce

No response

runsc version

No response

docker version (if using docker)

No response

uname

No response

kubectl (if using Kubernetes)

No response

repo state (if built from source)

No response

runsc debug logs (if available)

No response

nixprime avatar Jun 20 '24 20:06 nixprime

A friendly reminder that this issue had no activity for 120 days.

github-actions[bot] avatar Oct 19 '24 00:10 github-actions[bot]

This issue has been closed due to lack of activity.

github-actions[bot] avatar Jan 17 '25 00:01 github-actions[bot]

There are TODOs still referencing this issue:

  1. pkg/sentry/kernel/syscalls.go:500: checkescape can't distinguish between this

Search TODO

github-actions[bot] avatar Jan 18 '25 00:01 github-actions[bot]