-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gocore: explicitly load symbols from executable ELF file
This fixes partial typing fails when the core in question is complete (meaning: no section has Filesz != Memsz). Such cores can be triggered on Linux by writing (see core(5)): echo 0x3f > /proc/self/coredump_filter In this case, none of the mem mappings are backed by the executable file on disk. This meant that the previous readSymbols implementation only reads the core file (which it ignored anyway). Instead of looping over the mappings, read the symbols explicitly from the executable. I added a test which fails before my change. I had to refactor the testing code a little bit to make it easier to pass an environment variable. Unfortunately, changing /proc/self/coredump_filter means writing to a file. Pulling in a dependency on package os makes the dominator tests panic. For now I've disabled these tests: we're not sure it worked well anyway (it must have crashed for non-trivial programs). There may need to be more improvements in general typing/walking before re-enabling it. In principle, the dominator failure could be partially avoided by using build tags and not running the dominator test when coredump_filter doesn't need to be manipulated. But given what I wrote before, I don't see why we should bother. The history of this is interesting: - https://go.dev/cl/137375 is the last good change to this part of the code. It reads symbols from all loaded executables. Its CL description mentions that this is required for PIE and mixed (e.g.: Go/C++ binaries). Yet the PIE and (internal) mixed binary tests continue to pass with this change: - I found that PIE support didn't work and added it in https://go.dev/cl/618977 (with tests). Perhaps this is a reference to PIE support that was somehow removed in-between. - viewcore does not explicitly support mixed binaries, in the sense that it does not (attempt) to understand C objects. The PIE tests - https://go.dev/cl/506558 introduced the full core bug by replacing the read from all executable files with an iteration of the mappings. Change-Id: I2538cd863da72a9ebfc9415b32a97bf962479b61 Reviewed-on: https://go-review.googlesource.com/c/debug/+/637415 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
- Loading branch information
Showing
3 changed files
with
80 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters