From 2ccf0adec3e674aae4c144c7357b3668e4266341 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 30 Dec 2018 09:39:28 +0100 Subject: [PATCH] pkg/report: parse linux stack corruption reports --- pkg/report/linux.go | 20 +++++ pkg/report/testdata/linux/report/320 | 8 ++ pkg/report/testdata/linux/report/321 | 113 +++++++++++++++++++++++++++ pkg/report/testdata/linux/report/322 | 48 ++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 pkg/report/testdata/linux/report/320 create mode 100644 pkg/report/testdata/linux/report/321 create mode 100644 pkg/report/testdata/linux/report/322 diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 19a312f9..76a09019 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -1187,6 +1187,26 @@ var linuxOopses = []*oops{ { []byte("Kernel panic"), []oopsFormat{ + // Note: for stack corruption reports kernel may fail + // to print function symbol name and/or unwind stack. + { + title: compile("Kernel panic - not syncing: stack-protector:"), + report: compile("Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: {{FUNC}}"), + fmt: "kernel panic: stack is corrupted in %[1]v", + noStackTrace: true, + }, + { + title: compile("Kernel panic - not syncing: stack-protector:"), + report: compile("Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: [a-f0-9]+"), + fmt: "kernel panic: stack is corrupted in %[1]v", + stack: &stackFmt{ + parts: []*regexp.Regexp{ + compile("Call Trace:"), + parseStackTrace, + }, + skip: []string{"stack_chk"}, + }, + }, { title: compile("Kernel panic - not syncing: Attempted to kill init!"), fmt: "kernel panic: Attempted to kill init!", diff --git a/pkg/report/testdata/linux/report/320 b/pkg/report/testdata/linux/report/320 new file mode 100644 index 00000000..a9fa2ab0 --- /dev/null +++ b/pkg/report/testdata/linux/report/320 @@ -0,0 +1,8 @@ +TITLE: kernel panic: stack is corrupted in udp4_lib_lookup2 + +[ 678.752880] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: udp4_lib_lookup2+0x7ea/0x7f0 +[ 678.763686] CPU: 1 PID: 23879 Comm: syz-executor5 Not tainted 4.20.0+ #176 +[ 678.770720] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 +[ 678.780077] Call Trace: +[ 678.783693] Kernel Offset: disabled +[ 678.787320] Rebooting in 86400 seconds.. diff --git a/pkg/report/testdata/linux/report/321 b/pkg/report/testdata/linux/report/321 new file mode 100644 index 00000000..0b80fad2 --- /dev/null +++ b/pkg/report/testdata/linux/report/321 @@ -0,0 +1,113 @@ +TITLE: kernel panic: stack is corrupted in br_dev_xmit + +[ 254.788396] bridge0: received packet on gretap0 with own address as source address (addr:aa:aa:aa:aa:aa:0c, vlan:0) +[ 254.800034] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: br_dev_xmit+0x12ec/0x1550 +[ 254.800034] +[ 254.811975] CPU: 1 PID: 21341 Comm: syz-executor0 Not tainted 4.16.0+ #294 +[ 254.818978] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 +[ 254.828322] Call Trace: +[ 254.830892] +[ 254.833100] dump_stack+0x1a7/0x27d +[ 254.845262] panic+0x1f8/0x42c +[ 254.874451] __stack_chk_fail+0x22/0x30 +[ 254.878417] br_dev_xmit+0x12ec/0x1550 +[ 254.919010] dev_hard_start_xmit+0x24e/0xac0 +[ 254.934421] sctp: [Deprecated]: syz-executor4 (pid 21370) Use of int in maxseg socket option. +[ 254.934421] Use struct sctp_assoc_value instead +[ 254.980126] __dev_queue_xmit+0x26cf/0x2fd0 +[ 255.014107] sctp: [Deprecated]: syz-executor4 (pid 21373) Use of int in maxseg socket option. +[ 255.014107] Use struct sctp_assoc_value instead +[ 255.053307] kernel msg: ebtables bug: please report to author: Valid hook without chain +[ 255.072107] kernel msg: ebtables bug: please report to author: EBT_ENTRY_OR_ENTRIES shouldn't be set in distinguisher +[ 255.122065] kernel msg: ebtables bug: please report to author: Valid hook without chain +[ 255.125754] dev_queue_xmit+0x17/0x20 +[ 255.125774] ip_finish_output2+0xf4d/0x1550 +[ 255.156703] sctp: [Deprecated]: syz-executor4 (pid 21390) Use of int in maxseg socket option. +[ 255.156703] Use struct sctp_assoc_value instead +[ 255.158201] ip_finish_output+0x864/0xd60 +[ 255.175664] kernel msg: ebtables bug: please report to author: EBT_ENTRY_OR_ENTRIES shouldn't be set in distinguisher +[ 255.180547] ip_mc_output+0x271/0x1350 +[ 255.286554] ip_local_out+0x95/0x160 +[ 255.290313] iptunnel_xmit+0x556/0x810 +[ 255.294200] ip_tunnel_xmit+0x16fc/0x3550 +[ 255.327878] __gre_xmit+0x546/0x8b0 +[ 255.331484] gre_tap_xmit+0x2b7/0x510 +[ 255.339313] dev_hard_start_xmit+0x24e/0xac0 +[ 255.388324] sch_direct_xmit+0x40d/0x1140 +[ 255.406209] __qdisc_run+0x676/0x19b0 +[ 255.435916] __dev_queue_xmit+0xb8b/0x2fd0 +[ 255.517563] dev_queue_xmit+0x17/0x20 +[ 255.525282] br_dev_queue_push_xmit+0x196/0x5a0 +[ 255.533785] br_forward_finish+0xc8/0x530 +[ 255.559302] __br_forward+0x533/0xc80 +[ 255.583930] deliver_clone+0x63/0xc0 +[ 255.587624] br_flood+0x612/0x770 +[ 255.598888] br_dev_xmit+0xa68/0x1550 +[ 255.643297] dev_hard_start_xmit+0x24e/0xac0 +[ 255.691004] __dev_queue_xmit+0x26cf/0x2fd0 +[ 255.803518] dev_queue_xmit+0x17/0x20 +[ 255.811240] ip_finish_output2+0xf4d/0x1550 +[ 255.840707] ip_finish_output+0x864/0xd60 +[ 255.875583] ip_mc_output+0x271/0x1350 +[ 255.931605] ip_local_out+0x95/0x160 +[ 255.935291] iptunnel_xmit+0x556/0x810 +[ 255.939156] ip_tunnel_xmit+0x16fc/0x3550 +[ 255.982190] __gre_xmit+0x546/0x8b0 +[ 255.985794] erspan_xmit+0x779/0x22b0 +[ 256.011824] dev_hard_start_xmit+0x24e/0xac0 +[ 256.067671] sch_direct_xmit+0x40d/0x1140 +[ 256.085543] __qdisc_run+0x676/0x19b0 +[ 256.115185] __dev_queue_xmit+0xb8b/0x2fd0 +[ 256.343177] dev_queue_xmit+0x17/0x20 +[ 256.350892] br_dev_queue_push_xmit+0x196/0x5a0 +[ 256.359665] br_nf_dev_queue_xmit+0x2f1/0x1690 +[ 256.395673] br_nf_post_routing+0xc56/0x1570 +[ 256.439088] nf_hook_slow+0xba/0x1a0 +[ 256.442776] br_forward_finish+0x34a/0x530 +[ 256.460132] br_nf_hook_thresh+0x406/0x560 +[ 256.485897] br_nf_forward_finish+0x313/0x670 +[ 256.495182] br_nf_forward_ip+0xcee/0x1ae0 +[ 256.575146] nf_hook_slow+0xba/0x1a0 +[ 256.578835] __br_forward+0x49c/0xc80 +[ 256.603388] deliver_clone+0x63/0xc0 +[ 256.607076] br_flood+0x5c6/0x770 +[ 256.622791] br_handle_frame_finish+0x5e3/0x15e0 +[ 256.668972] br_nf_hook_thresh+0x406/0x560 +[ 256.686593] br_nf_pre_routing_finish+0x87b/0x18e0 +[ 256.730755] br_nf_pre_routing+0xdbd/0x14b0 +[ 256.765565] nf_hook_slow+0xba/0x1a0 +[ 256.769251] br_handle_frame+0xb5b/0x1740 +[ 256.825444] __netif_receive_skb_core+0x984/0x3480 +[ 256.916166] __netif_receive_skb+0x2c/0x1b0 +[ 256.924931] process_backlog+0x203/0x740 +[ 256.933172] net_rx_action+0x788/0x1910 +[ 257.039896] __do_softirq+0x2d7/0xb85 +[ 257.096312] do_softirq_own_stack+0x2a/0x40 +[ 257.100602] +[ 257.102813] do_softirq.part.19+0x14d/0x190 +[ 257.111577] __local_bh_enable_ip+0x1ee/0x230 +[ 257.116048] ip_finish_output2+0x962/0x1550 +[ 257.144200] ip_finish_output+0x864/0xd60 +[ 257.179070] ip_output+0x1d2/0x860 +[ 257.199540] ip_local_out+0x95/0x160 +[ 257.203227] ip_send_skb+0x3c/0xc0 +[ 257.206741] ip_push_pending_frames+0x64/0x80 +[ 257.211210] raw_sendmsg+0x1d4d/0x26b0 +[ 257.272778] inet_sendmsg+0x11f/0x5e0 +[ 257.292972] sock_sendmsg+0xca/0x110 +[ 257.296658] __sys_sendto+0x365/0x5a0 +[ 257.335276] SyS_sendto+0x40/0x60 +[ 257.342650] do_syscall_64+0x281/0x940 +[ 257.384559] entry_SYSCALL_64_after_hwframe+0x42/0xb7 +[ 257.389723] RIP: 0033:0x4552d9 +[ 257.392885] RSP: 002b:00007f4d152e6c68 EFLAGS: 00000246 ORIG_RAX: 000000000000002c +[ 257.400562] RAX: ffffffffffffffda RBX: 00007f4d152e76d4 RCX: 00000000004552d9 +[ 257.407802] RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000013 +[ 257.415046] RBP: 000000000072bea0 R08: 0000000020000080 R09: 0000000000000010 +[ 257.422288] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff +[ 257.429530] R13: 00000000000004f2 R14: 00000000006fa750 R15: 0000000000000000 +[ 257.437463] Dumping ftrace buffer: +[ 257.441182] (ftrace buffer empty) +[ 257.444864] Kernel Offset: disabled +[ 257.448463] Rebooting in 86400 seconds.. + diff --git a/pkg/report/testdata/linux/report/322 b/pkg/report/testdata/linux/report/322 new file mode 100644 index 00000000..d68a4d5b --- /dev/null +++ b/pkg/report/testdata/linux/report/322 @@ -0,0 +1,48 @@ +TITLE: kernel panic: stack is corrupted in ip6_xmit + +[ 122.900948] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff8343632e +[ 122.900948] +[ 122.911966] CPU: 1 PID: 7987 Comm: syz-executor1 Not tainted 4.4.153-g5e24b4e #90 +[ 122.919579] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 +[ 122.928927] 0000000000000000 4e89b9f42d2c5391 ffff8801d7e476e0 ffffffff81e162ed +[ 122.937002] ffffffff83a44c60 00000000ffffffff ffff8801ca3dbe80 ffff8801d7e47a20 +[ 122.945072] 0000000000000000 ffff8801d7e477a0 ffffffff8140d474 0000000041b58ab3 +[ 122.953181] Call Trace: +[ 122.955761] [] dump_stack+0xc1/0x124 +[ 122.961127] [] panic+0x19e/0x38d +[ 122.966141] [] ? add_taint.cold.4+0x16/0x16 +[ 122.972109] [] ? nf_iterate+0x210/0x210 +[ 122.977740] [] ? ip6_xmit+0x18ae/0x1a00 +[ 122.983367] [] ? ip6_xmit+0x18ae/0x1a00 +[ 122.988991] [] __stack_chk_fail+0x22/0x30 +[ 122.994784] [] ip6_xmit+0x18ae/0x1a00 +[ 123.000229] [] ? _raw_spin_unlock_irqrestore+0x45/0x70 +[ 123.007148] [] ? ip6_finish_output2+0x1ca0/0x1ca0 +[ 123.013650] [] ? __lock_is_held+0xa2/0xf0 +[ 123.019479] [] ? ipv4_dst_check+0x111/0x160 +[ 123.025462] [] ? ip6_append_data+0x2b0/0x2b0 +[ 123.031521] [] inet6_csk_xmit+0x245/0x490 +[ 123.037335] [] ? inet6_csk_xmit+0xff/0x490 +[ 123.043233] [] ? inet6_csk_update_pmtu+0x160/0x160 +[ 123.049815] [] ? udp6_set_csum+0xd3/0xa70 +[ 123.055628] [] l2tp_xmit_skb+0xb9c/0xe80 +[ 123.061351] [] pppol2tp_sendmsg+0x4e0/0x7d0 +[ 123.067330] [] ? selinux_socket_sendmsg+0x3f/0x50 +[ 123.073832] [] ? pppol2tp_release+0x310/0x310 +[ 123.079979] [] sock_sendmsg+0xcc/0x110 +[ 123.085521] [] sock_write_iter+0x223/0x3b0 +[ 123.091406] [] ? sock_sendmsg+0x110/0x110 +[ 123.097206] [] ? iov_iter_init+0xaf/0x1d0 +[ 123.103001] [] __vfs_write+0x30d/0x3f0 +[ 123.108536] [] ? __vfs_read+0x3e0/0x3e0 +[ 123.114162] [] ? selinux_file_permission+0x2f2/0x450 +[ 123.120917] [] ? rw_verify_area+0x100/0x300 +[ 123.127146] [] vfs_write+0x191/0x4e0 +[ 123.132511] [] SyS_write+0xd9/0x1c0 +[ 123.137786] [] ? SyS_read+0x1c0/0x1c0 +[ 123.143243] [] ? lockdep_sys_exit_thunk+0x12/0x14 +[ 123.149736] [] entry_SYSCALL_64_fastpath+0x22/0x9e +[ 123.156741] Dumping ftrace buffer: +[ 123.160329] (ftrace buffer empty) +[ 123.164020] Kernel Offset: disabled +[ 123.167641] Rebooting in 86400 seconds..