[minicoredumper] Rework get_stack_pointer for linux above 4.8

John Ogness john.ogness at linutronix.de
Tue Nov 7 10:16:31 CET 2017


Hello Marco,

As of 4.9.60 [0] and 4.13.11 [1], the stack pointer is available to
minicoredumper again. I assume the change will eventually trickle down
to the various distributions.

For the following kernel versions, the problem you identified will
forever exist:

4.13.0-10
4.12.* (EOF)
4.11.* (EOF)
4.10.* (EOF)
4.9.0-59

Should we care about these kernels? I was considering modifying
minicoredumper to automatically add the "[stack]" map if the program
counter is 0. Obviously this would dump a lot more than just the used
stack, but this may be preferrable to partial or missing stacks for
users of these kernels. Any thoughts?

John Ogness

[0] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/fs/proc/array.c?h=v4.9.60&id=9ad15a25669ec8c120e910cf18620af2455cb6df
[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/fs/proc/array.c?h=v4.13.11&id=ca2d34891acd1fedf7a7e8d2a9cbad7b90997b08


On 2017-09-18, John Ogness <john.ogness at linutronix.de> wrote:
> Hello Marco,
>
> I appreciate your hard work on this issue. After much thought I have
> decided that we should not begin manually interpretting the core data
> to find the stack pointer. There are too many platforms that would
> need to be supported (and tested!). This is a Linux user API
> regression issue and is being handled as such [0].
>
> Once that change makes it to the appropriate stable branches, this
> issue will resolve itself.
>
> John Ogness
>
> [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fd7d56270b526ca3ed0c224362e3c64a0f86687a
>
> On 2017-08-02, Marco Felsch <Marco.Felsch at preh.de> wrote:

>> The stack pointer isn't reported to the proc-fs since linux kernel
>> 4.9.  It turned out [0] that we need to parse the kernel coredump
>> ELF-header to obtain the stack pointers for each thread. This has the
>> disadvantage of architecture depency. Therefore we keep the proc-fs
>> methode for kernel below 4.9 and inform the user if he use a kernel >
>> 4.9 and use a unsupported architecture.
>>
>> This patch series is an approach to parse the stack pointer from the
>> ELF-header. Currently only the arm64 is supported because of my
>> target arch.  I've tested it with a linux kernel 4.9 and it works as
>> it should.
>>
>> [0] http://lists.linutronix.de/pipermail/minicoredumper/2017-July/000044.html
>>
>> Marco Felsch (2):
>>   minicoredumper: add new task_info struct
>>   minicoredumper: add new get_stack_pointer function
>>
>>  configure.ac                      |  14 ++-
>>  src/minicoredumper/corestripper.c | 214 +++++++++++++++++++++++++++++++++++++-
>>  src/minicoredumper/corestripper.h |   7 ++
>>  3 files changed, 232 insertions(+), 3 deletions(-)



More information about the minicoredumper mailing list