Skip to content

Kernel panics

Tim Crawford edited this page May 17, 2019 · 2 revisions

In the event of a panic or oops, the kernel will produce a stack trace.

general protection fault: 0000 [#1] SMP PTI
CPU: 0 PID: 444 Comm: xfsaild/dm-0 Tainted: G           OE     4.18.16-200.fc28.x86_64 #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS ?-20180531_142017-buildhw-08.phx2.fedoraproject.org-1.fc28 04/01/2014
RIP: 0010:tracing_mrf+0x164/0x600 [dattobd]
Code: d8 48 c1 e0 04 4c 01 c8 8b 78 08 48 8b 08 89 f8 29 f0 39 d8 0f 47 c3 48 85 c9 74 7e 48 8b 49 18 48 85 c9 74 75 f6 c1 01 75 70 <48> 8b 09 49 39 cd 0f 85 8f 02 00 00 41 8b 4e 10 44 0f b6 c1 41 83 
RSP: 0018:ffffb186c0557be0 EFLAGS: 00010246
RAX: 0000000000000200 RBX: 0000000000000200 RCX: dead000000000400
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000200
RBP: 0000000000000001 R08: ffff8e0f2c990700 R09: ffff8e0f2c990788
R10: ffffffff87731a00 R11: 0000000000000000 R12: ffff8e0f2c990700
R13: ffff8e0f24abf978 R14: ffff8e0f2c990700 R15: ffff8e0f25822800
FS:  0000000000000000(0000) GS:ffff8e0f3fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd8cccf7000 CR3: 000000005820a005 CR4: 00000000001606f0
Call Trace:
 ? generic_make_request_checks+0x393/0x630
 generic_make_request+0x1a4/0x410
 submit_bio+0x45/0x140
 ? bio_add_page+0x42/0x50
 _xfs_buf_ioapply+0x2e2/0x480 [xfs]
 ? wake_up_q+0x70/0x70
 ? xfs_buf_delwri_submit_buffers+0x110/0x2a0 [xfs]
 xfs_buf_submit+0x5f/0x1f0 [xfs]
 xfs_buf_delwri_submit_buffers+0x110/0x2a0 [xfs]
 ? xfsaild+0x29f/0x7b0 [xfs]
 ? xfs_inode_item_push+0xbc/0x170 [xfs]
 xfsaild+0x29f/0x7b0 [xfs]
 ? xfs_trans_ail_cursor_first+0x80/0x80 [xfs]
 kthread+0x112/0x130
 ? kthread_create_worker_on_cpu+0x70/0x70
 ret_from_fork+0x35/0x40
Modules linked in: dattobd(OE) ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_raw iptable_security ebtable_filter ebtables ip6table_filter ip6_tables kvm_intel kvm irqbypass crct10dif_pclmul iTCO_wdt crc32_pclmul iTCO_vendor_support snd_pcsp ghash_clmulni_intel snd_pcm snd_timer snd joydev soundcore i2c_i801 virtio_net net_failover virtio_balloon failover lpc_ich xfs libcrc32c qxl drm_kms_helper ttm drm crc32c_intel serio_raw virtio_console virtio_scsi qemu_fw_cfg
---[ end trace 51a4cd04ad61f50f ]---
RIP: 0010:tracing_mrf+0x164/0x600 [dattobd]
Code: d8 48 c1 e0 04 4c 01 c8 8b 78 08 48 8b 08 89 f8 29 f0 39 d8 0f 47 c3 48 85 c9 74 7e 48 8b 49 18 48 85 c9 74 75 f6 c1 01 75 70 <48> 8b 09 49 39 cd 0f 85 8f 02 00 00 41 8b 4e 10 44 0f b6 c1 41 83 
RSP: 0018:ffffb186c0557be0 EFLAGS: 00010246
RAX: 0000000000000200 RBX: 0000000000000200 RCX: dead000000000400
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000200
RBP: 0000000000000001 R08: ffff8e0f2c990700 R09: ffff8e0f2c990788
R10: ffffffff87731a00 R11: 0000000000000000 R12: ffff8e0f2c990700
R13: ffff8e0f24abf978 R14: ffff8e0f2c990700 R15: ffff8e0f25822800
FS:  0000000000000000(0000) GS:ffff8e0f3fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd8cccf7000 CR3: 000000005820a005 CR4: 00000000001606f0
---[ end trace 2c8e01f3f525c0f3 ]---

The RIP is the instruction pointer. It holds the address the kernel executed when the fault was triggered.

RIP: 0010:tracing_mrf+0x164/0x600 [dattobd]

Convert this to a line number using GDB.

gdb /path/to/dattobd.ko
(gdb) list *(tracing_mrf+0x164)
0x2ad4 is in tracing_mrf (/root/dattobd/src/dattobd.c:2388).
2383	
2384	static inline struct inode *page_get_inode(struct page *pg){
2385		if(!pg) return NULL;
2386		if(!pg->mapping) return NULL;
2387		if((unsigned long)pg->mapping & PAGE_MAPPING_ANON) return NULL;
2388		if(!pg->mapping->host) return NULL;
2389		return pg->mapping->host;
2390	}
2391	
2392	static int bio_needs_cow(struct bio *bio, struct inode *inode){

See also: https://www.kernel.org/doc/html/latest/admin-guide/bug-hunting.html

Clone this wiki locally