]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kerneldump: Inline dump_savectx() into its callers
authorMark Johnston <markj@FreeBSD.org>
Mon, 20 Mar 2023 18:16:00 +0000 (14:16 -0400)
committerMark Johnston <markj@FreeBSD.org>
Wed, 22 Mar 2023 13:47:34 +0000 (09:47 -0400)
commit94c208a07f70512aa3aadcde8b3ee7f605ae6bf3
tree5709cd7e9534e78683bdbbb3b2fae4ede18ef3b2
parent8295571e3f6a3de2fd0d3fcdcb9882bf73a47967
kerneldump: Inline dump_savectx() into its callers

The callers of dump_savectx() (i.e., doadump() and livedump_start())
subsequently call dumpsys()/minidumpsys(), which dump the calling
thread's stack when writing the dump.  If dump_savectx() gets its own
stack frame, that frame might be clobbered when its caller later calls
dumpsys()/minidumpsys(), making it difficult for debuggers to unwind the
stack.

Fix this by making dump_savectx() a macro, so that savectx() is always
called directly by the function which subsequently calls
dumpsys()/minidumpsys().

This fixes stack unwinding for the panicking thread from arm64
minidumps.  The same happened to work on amd64, but kgdb reports the
dump_savectx() calls as coming from dumpsys(), so in that case it
appears to work by accident.

Approved by: re (gjb)
Fixes: c9114f9f86f9 ("Add new vnode dumper to support live minidumps")
Reviewed by: mhorne, jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39151

(cherry picked from commit c3179891f897d840f578a5139839fcacb587c96d)
(cherry picked from commit 2310894c1021f49b6c3003ba215ca978eee2be75)
sys/kern/kern_shutdown.c
sys/kern/kern_vnodedumper.c
sys/sys/conf.h