svn commit: r311343 - head/sys/mips/mips

John Baldwin jhb at freebsd.org
Thu Jan 5 16:44:37 UTC 2017


On Thursday, January 05, 2017 12:59:53 AM John Baldwin wrote:
> Author: jhb
> Date: Thu Jan  5 00:59:53 2017
> New Revision: 311343
> URL: https://svnweb.freebsd.org/changeset/base/311343
> 
> Log:
>   Use db_printsym() to display function names in stack traces.
>   
>   Previously, the stack unwinder tried to locate the start of the function
>   in each frame by walking backwards until it found an instruction that
>   modified the stack pointer and then assumed that was the first instruction
>   in a function.  The unwinder would only print a function name if the
>   starting instruction's address was an exact match for a symbol name.
>   However, not all functions generated by modern compilers start off functions
>   with that instruction.  For those functions, the unwinder would fail to
>   find a matching function name.  As a result, most frames in a stack
>   trace would be printed as raw hex PC's instead of a function name.
>   
>   Stop depending on this incorrect assumption and just use db_printsym()
>   like other platforms to display the function name and offset for each
>   frame.  This generates a far more useful stack trace.
>   
>   While here, don't print out curproc's pid at the end of the trace.  The
>   pid was always from curproc even if tracing some other process.
>   
>   In addition, remove some rotted comments about hardcoded constants that
>   are no longer hardcoded.
>   
>   Sponsored by:	DARPA / AFRL

After these (and previous fixes), the original kernel stack overflow I
saw earlier now results in a much more usable stack trace from DDB.  Note
that some of the function names are false positives due to no symbols for
static functions, but many more frames were false negatives previously.

panic: kernel stack overflow - trapframe at 0xffffffff806d9eb0
KDB: enter: panic
[ thread pid 624 tid 100043 ]
Stopped at      0x4:
db> tr
Tracing pid 624 tid 100043 td 0x98000000016baa20
kdb_enter+0x88 (?,?,?,?) ra ffffffff8031cbc8 sp ffffffff806d9e00 sz 16
vpanic+0x1b0 (?,?,?,?) ra ffffffff8031cc30 sp ffffffff806d9e10 sz 32
kassert_panic (?,ffffffff806d9eb0,ffffffffffffffec,ffffffff802fce94) ra ffffffff80569fec sp ffffffff806d9e30 sz 96
MipsKStackOverflow (?,?,?,?) ra 0 sp ffffffff806d9e90 sz 0
--- exception, cause 7 badvaddr 1 ---
thread_lock_flags_+0xc (?,?,?,?) ra ffffffff802acf4c sp c00000002a5a9fb0 sz 96
statclock_cnt+0x1ec (?,?,?,?) ra ffffffff80581388 sp c00000002a5aa010 sz 32
cpu_set_upcall+0x668 (?,?,?,?) ra ffffffff805816f8 sp c00000002a5aa030 sz 64
cpu_set_upcall+0x9d8 (?,?,?,?) ra ffffffff8058ae94 sp c00000002a5aa070 sz 48
DELAY+0x4e4 (?,?,?,?) ra ffffffff802db900 sp c00000002a5aa0a0 sz 64
intr_event_handle+0xb0 (?,?,?,?) ra ffffffff8058a250 sp c00000002a5aa0e0 sz 64
cpu_intr+0x230 (?,?,?,?) ra ffffffff80569840 sp c00000002a5aa120 sz 80
MipsKernIntr+0x188 (?,?,?,?) ra 0 sp c00000002a5aa170 sz 0
--- exception, cause 0 badvaddr ffffffff8043d700 ---
bpf_mtap+0x88 (?,?,?,?) ra ffffffff80190028 sp c00000002a5aa2e0 sz 96
am7990_config+0x680 (?,?,?,?) ra ffffffff801925fc sp c00000002a5aa340 sz 96
lance_init_locked+0x564 (?,?,?,?) ra ffffffff8042fbdc sp c00000002a5aa3a0 sz 32
if_start+0x14 (?,?,?,?) ra ffffffff804317f8 sp c00000002a5aa3c0 sz 16
if_handoff+0x340 (?,?,?,?) ra ffffffff8043cfe0 sp c00000002a5aa3d0 sz 48
ether_output_frame+0x80 (?,9800000001629e00,?,?) ra ffffffff8043d700 sp c00000002a5aa400 sz 32
ether_output+0x710 (?,9800000001629e00,?,?) ra ffffffff80484618 sp c00000002a5aa420 sz 112
ip_output+0x1af8 (9800000001629e00,?,?,0) ra ffffffff804986bc sp c00000002a5aa490 sz 304
tcp_output+0x209c (?,?,?,?) ra ffffffff804aa8e8 sp c00000002a5aa5c0 sz 368
tcp_twstart+0x2c70 (?,?,?,?) ra ffffffff803c7220 sp c00000002a5aa730 sz 96
sosend_generic+0x618 (?,0,?,?) ra ffffffff803c3cb4 sp c00000002a5aa790 sz 160
sosend+0x1c (?,?,?,?) ra ffffffff804bb2f0 sp c00000002a5aa830 sz 16
clnt_vc_create+0x1208 (?,?,15,980000000162d900) ra ffffffff804b993c sp c00000002a5aa840 sz 320
clnt_reconnect_create+0xec4 (9800000001630400,?,15,980000000162d900) ra ffffffff801e225c sp c00000002a5aa980 sz 176
newnfs_request+0x9f4 (?,?,?,?) ra ffffffff8023466c sp c00000002a5aaa30 sz 336
nfscl_request+0x7c (?,?,?,?) ra ffffffff8020e2d0 sp c00000002a5aab80 sz 64
nfsrpc_commit+0x470 (?,?,?,?) ra ffffffff802276f8 sp c00000002a5aabc0 sz 368
ncl_commit+0xf8 (9800000004440760,?,?,?) ra ffffffff80227bfc sp c00000002a5aad30 sz 288
ncl_flush+0x474 (9800000004440760,?,?,98000000016baa20) ra ffffffff802285d0 sp c00000002a5aae50 sz 384
ncl_flush+0xe48 (?,?,?,?) ra ffffffff80591390 sp c00000002a5aafd0 sz 16
VOP_FSYNC_APV+0x118 (?,?,?,?) ra ffffffff803df524 sp c00000002a5aafe0 sz 32
bufsync+0x5c (9800000004440760,1,?,?) ra ffffffff8040e030 sp c00000002a5ab000 sz 48
bufobj_invalbuf+0xf8 (?,?,?,?) ra ffffffff8040e3e0 sp c00000002a5ab030 sz 96
vinvalbuf+0x28 (?,?,?,?) ra ffffffff80239780 sp c00000002a5ab090 sz 16
ncl_vinvalbuf+0x170 (?,?,?,?) ra ffffffff80226b58 sp c00000002a5ab0a0 sz 96
ncl_removeit+0x298 (?,?,?,?) ra ffffffff805920b8 sp c00000002a5ab100 sz 304
VOP_SETATTR_APV+0x118 (?,?,?,?) ra ffffffff8023c4e0 sp c00000002a5ab230 sz 32
ncl_write+0x13c0 (4101,?,?,?) ra ffffffff805924f4 sp c00000002a5ab250 sz 512
VOP_WRITE_APV+0x18c (?,?,?,?) ra ffffffff8041e6a0 sp c00000002a5ab450 sz 256
vn_utimes_perm+0x1d8 (?,?,?,?) ra ffffffff8041e840 sp c00000002a5ab550 sz 64
vn_utimes_perm+0x378 (?,?,?,?) ra ffffffff804218a0 sp c00000002a5ab590 sz 320
vn_rdwr+0x1b0 (1,?,16042b000,10000) ra ffffffff80421b00 sp c00000002a5ab6d0 sz 240
vn_rdwr_inchunks+0xc8 (?,?,?,?) ra ffffffff802a1764 sp c00000002a5ab7c0 sz 144
elf64_brand_inuse+0x964 (?,?,?,?) ra ffffffff802a2070 sp c00000002a5ab850 sz 48
elf64_coredump+0x7d8 (?,9800000004440760,7fffffffffffffff,?) ra ffffffff80320320 sp c00000002a5ab880 sz 256
sigexit+0xb58 (?,?,?,?) ra ffffffff803226cc sp c00000002a5ab980 sz 672
postsig+0x1e4 (?,?,?,?) ra ffffffff8038cfb8 sp c00000002a5abc20 sz 192
ast+0x418 (?,?,?,?) ra ffffffff8056951c sp c00000002a5abce0 sz 48
MipsUserGenException+0x1d8 (?,?,?,120000ff0) ra 0 sp c00000002a5abd10 sz 0


-- 
John Baldwin


More information about the svn-src-all mailing list