From 1b3ae9a6d0f41849f8a4c9ee7b0b244fc011d117 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 12 Dec 2017 13:29:45 +0100 Subject: [PATCH] pkg/report: handle syzkaller binaries syzkallerNNN binaries are coming from pkg/repro. --- pkg/osutil/fileutil.go | 1 + pkg/report/linux.go | 7 ++-- pkg/report/testdata/linux/report/131 | 48 ++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 pkg/report/testdata/linux/report/131 diff --git a/pkg/osutil/fileutil.go b/pkg/osutil/fileutil.go index 5ef79e1b..3e107828 100644 --- a/pkg/osutil/fileutil.go +++ b/pkg/osutil/fileutil.go @@ -42,6 +42,7 @@ func CopyFile(oldFile, newFile string) error { // WriteTempFile writes data to a temp file and returns its name. func WriteTempFile(data []byte) (string, error) { + // Note: pkg/report knows about "syzkaller" prefix as it appears in crashes as process name. f, err := ioutil.TempFile("", "syzkaller") if err != nil { return "", fmt.Errorf("failed to create a temp file: %v", err) diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 3e53488a..a672545d 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -188,7 +188,9 @@ func (ctx *linux) Parse(output []byte) *Report { rep.Report = append(rep.Report, report...) rep.Corrupted = ctx.isCorrupted(title, report, format) // Executor PIDs are not interesting. - rep.Title = executorRe.ReplaceAllLiteralString(rep.Title, "syz-executor") + rep.Title = executorBinRe.ReplaceAllLiteralString(rep.Title, "syz-executor") + // syzkaller binaries are coming from repro. + rep.Title = syzkallerBinRe.ReplaceAllLiteralString(rep.Title, "syzkaller") // Replace that everything looks like an address with "ADDR", // addresses in descriptions can't be good regardless of the oops regexps. rep.Title = addrRe.ReplaceAllString(rep.Title, "${1}ADDR") @@ -428,7 +430,8 @@ var ( decNumRe = regexp.MustCompile(`([^a-zA-Z])[0-9]{5,}`) funcRe = regexp.MustCompile(`([a-zA-Z][a-zA-Z0-9_.]+)\+0x[0-9a-z]+/0x[0-9a-z]+`) cpuRe = regexp.MustCompile(`CPU#[0-9]+`) - executorRe = regexp.MustCompile(`syz-executor[0-9]+((/|:)[0-9]+)?`) + executorBinRe = regexp.MustCompile(`syz-executor[0-9]+((/|:)[0-9]+)?`) + syzkallerBinRe = regexp.MustCompile(`syzkaller[0-9]+((/|:)[0-9]+)?`) ) var linuxCorruptedTitles = []*regexp.Regexp{ diff --git a/pkg/report/testdata/linux/report/131 b/pkg/report/testdata/linux/report/131 new file mode 100644 index 00000000..17fff489 --- /dev/null +++ b/pkg/report/testdata/linux/report/131 @@ -0,0 +1,48 @@ +TITLE: BUG: using __this_cpu_read() in preemptible [ADDR] code: syzkaller + +syzkaller login: [ 35.184476] BUG: using __this_cpu_read() in preemptible [00000000] code: syzkaller195313/3344 +[ 35.193222] caller is __this_cpu_preempt_check+0x1c/0x20 +[ 35.198727] CPU: 1 PID: 3344 Comm: syzkaller195313 Not tainted 4.9.68-gfb66dc2 #107 +[ 35.206487] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 +[ 35.215825] ffff8801c8e476d8 ffffffff81d90889 0000000000000001 ffffffff83c17800 +[ 35.223786] ffffffff83f42ec0 ffff8801c7643000 0000000000000003 ffff8801c8e47718 +[ 35.231779] ffffffff81df7854 ffff8801c8e47730 ffffffff83f42ec0 dffffc0000000000 +[ 35.239734] Call Trace: +[ 35.242294] [] dump_stack+0xc1/0x128 +[ 35.247625] [] check_preemption_disabled+0x1d4/0x200 +[ 35.254346] [] __this_cpu_preempt_check+0x1c/0x20 +[ 35.260808] [] ipcomp_init_state+0x188/0x930 +[ 35.266833] [] ? __lock_is_held+0xa1/0xf0 +[ 35.272602] [] ipcomp4_init_state+0xb0/0x7d0 +[ 35.278628] [] __xfrm_init_state+0x3e7/0xb30 +[ 35.284654] [] xfrm_init_state+0x1a/0x20 +[ 35.290339] [] pfkey_add+0x1fb9/0x3470 +[ 35.295843] [] ? pfkey_delete+0x360/0x360 +[ 35.301604] [] ? pfkey_seq_stop+0x80/0x80 +[ 35.307382] [] ? __skb_clone+0x24a/0x7d0 +[ 35.313066] [] ? pfkey_delete+0x360/0x360 +[ 35.318831] [] pfkey_process+0x61e/0x730 +[ 35.324509] [] ? pfkey_send_new_mapping+0x11b0/0x11b0 +[ 35.331317] [] ? trace_hardirqs_on_caller+0x38b/0x590 +[ 35.338125] [] pfkey_sendmsg+0x3a9/0x760 +[ 35.343802] [] ? pfkey_spdget+0x820/0x820 +[ 35.349568] [] sock_sendmsg+0xca/0x110 +[ 35.355070] [] ___sys_sendmsg+0x6d1/0x7e0 +[ 35.360832] [] ? copy_msghdr_from_user+0x550/0x550 +[ 35.367549] [] ? __lru_cache_add+0x187/0x250 +[ 35.373571] [] ? lru_cache_add+0xd9/0x1e0 +[ 35.379335] [] ? handle_mm_fault+0xb12/0x2530 +[ 35.385449] [] ? _raw_spin_unlock+0x2c/0x50 +[ 35.391387] [] ? handle_mm_fault+0x6ee/0x2530 +[ 35.397498] [] ? __lock_is_held+0xa1/0xf0 +[ 35.403261] [] ? __pmd_alloc+0x410/0x410 +[ 35.408938] [] ? __fget_light+0x158/0x1e0 +[ 35.414709] [] ? __fdget+0x18/0x20 +[ 35.419865] [] __sys_sendmsg+0xd6/0x190 +[ 35.425453] [] ? SyS_shutdown+0x1b0/0x1b0 +executing program +[ 35.431217] [] ? __do_page_fault+0x5ec/0xd40 +[ 35.437239] [] ? __do_page_fault+0x3bd/0xd40 +[ 35.443262] [] ? trace_hardirqs_on_caller+0x38b/0x590 +[ 35.450067] [] SyS_sendmsg+0x2d/0x50 +[ 35.455398] [] entry_SYSCALL_64_fastpath+0x23/0xc6