From 1363913cf7f6f203cff0ed1c9dc1269c492e68cf Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 2 Oct 2022 14:52:10 +0200 Subject: pkg/report: better replace numbers Currently "./syzkaller-testdir264563108" is replaced with "./syzkaller-testdir2ADDR". That's due to a bug in the ADDR replacement rule. Fix it. Also improve NUM replement b/c currently "testdir264563108" is considered as it can be a function name. --- pkg/report/report.go | 9 ++++++++- pkg/report/testdata/linux/report/660 | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 pkg/report/testdata/linux/report/660 (limited to 'pkg') diff --git a/pkg/report/report.go b/pkg/report/report.go index 179c38541..951478d8d 100644 --- a/pkg/report/report.go +++ b/pkg/report/report.go @@ -334,7 +334,7 @@ var dynamicTitleReplacement = []replacement{ { // Replace that everything looks like an address with "ADDR", // addresses in descriptions can't be good regardless of the oops regexps. - regexp.MustCompile(`([^a-zA-Z0])(?:0x)?[0-9a-f]{6,}`), + regexp.MustCompile(`([^a-zA-Z0-9])(?:0x)?[0-9a-f]{6,}`), "${1}ADDR", }, { @@ -365,6 +365,13 @@ var dynamicTitleReplacement = []replacement{ regexp.MustCompile(`(\W)(\d+)(\W|$)`), "${1}NUM${3}", }, + { + // Some decimal numbers can be a part of a function name, + // we need to preserve them (e.g. cfg80211* or nl802154*). + // However, if the number is too long, it's probably something else. + regexp.MustCompile(`(\d+){7,}`), + "NUM", + }, } func sanitizeTitle(title string) string { diff --git a/pkg/report/testdata/linux/report/660 b/pkg/report/testdata/linux/report/660 new file mode 100644 index 000000000..efa87f75e --- /dev/null +++ b/pkg/report/testdata/linux/report/660 @@ -0,0 +1,5 @@ +TITLE: SYZFATAL: executor NUM failed NUM times: failed to create temp dir: mkdir ./syzkaller-testdirNUM: read-only file system +ALT: SYZFATAL + +2022/10/02 11:34:15 SYZFATAL: executor 4 failed 11 times: failed to create temp dir: mkdir ./syzkaller-testdir264563108: read-only file system + -- cgit mrf-deployment