stack_decode.py doesn't work for stack traces from process using ASLR
- Dominant language
- C++
- Stars
- 28.9k
- Forks
- 5.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 437
Description
I'm running Envoy in a docker container under Kubernetes and it's crashing, producing a stack trace in the log output. Unfortunately, I can't translate the addresses in this stack trace using [tools/stack_decode.py](https://github.com/envoyproxy/envoy/blob/master/tools/stack_decode.py) because address space layout randomization (ASLR) was in effect when Envoy was running, and when it produces the stack trace, Envoy doesn't print the base address of the process so that the virtual addresses in the stack trace can be transformed into offsets suitable for `addr2line`. Once the Envoy process has ended, I have no way of getting the base address.
A secondary problem is that `stack_decode.py`, when run in the mode where it translates addresses that it reads from standard input, doesn't offer a syntax for providing the base address of the process. PR #12989 addressed this for the case when `stack_decode.py` itself is running the Envoy executable, but not for the other case.
Would it be possible to get Envoy to log the base address of the process at the beginning of stack trace, and then to either automatically adjust the addresses printed in the stack trace by that amount or to enhance `stack_decode.py` to allow the base address to be specified on the command line so the script can use it to adjust the addresses? To get the base address, [some technique](https://stackoverflow.com/a/7650408/10060200) similar to the following commands could be used:
```bash
cat /proc//maps | grep r-xp | grep envoy
```
(I'm sure there's a better way to do that in the Envoy code)
Contributor guide
Assessment
This issue has not been assessed yet.