From 1dff53dc25a42aeeca592d5701a6740f3144211d Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Thu, 3 Jul 2025 12:29:03 +0200 Subject: pkg/report: use crash.KASANUnknown instead of crash.KASANOther What we need is the category for "matched unknown KASAN bug". This king on bugs should be recategorised. The final goal is to keep this category empty. --- pkg/bisect/bisect_test.go | 24 ++++++++++++------------ pkg/report/crash/types.go | 4 ++-- pkg/report/title_to_type.go | 16 +++++++++------- pkg/vcs/linux_configs_test.go | 4 ++-- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index 11d14d4fc..30c83db32 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -918,47 +918,47 @@ func TestMostFrequentReport(t *testing.T) { { name: "one infrequent", reports: []*report.Report{ - {Title: "A", Type: crash.KASANOther}, - {Title: "B", Type: crash.KASANOther}, + {Title: "A", Type: crash.KASANRead}, + {Title: "B", Type: crash.KASANRead}, {Title: "C", Type: crash.Bug}, - {Title: "D", Type: crash.KASANOther}, + {Title: "D", Type: crash.KASANRead}, {Title: "E", Type: crash.Bug}, - {Title: "F", Type: crash.KASANOther}, + {Title: "F", Type: crash.KASANRead}, {Title: "G", Type: crash.LockdepBug}, }, // LockdepBug was too infrequent. - types: []crash.Type{crash.KASANOther, crash.Bug}, + types: []crash.Type{crash.KASANRead, crash.Bug}, report: "A", other: true, }, { name: "ignore hangs", reports: []*report.Report{ - {Title: "A", Type: crash.KASANOther}, - {Title: "B", Type: crash.KASANOther}, + {Title: "A", Type: crash.KASANRead}, + {Title: "B", Type: crash.KASANRead}, {Title: "C", Type: crash.Hang}, - {Title: "D", Type: crash.KASANOther}, + {Title: "D", Type: crash.KASANRead}, {Title: "E", Type: crash.Hang}, {Title: "F", Type: crash.Hang}, {Title: "G", Type: crash.Warning}, }, // Hang is not a preferred report type. - types: []crash.Type{crash.KASANOther, crash.Warning}, + types: []crash.Type{crash.KASANRead, crash.Warning}, report: "A", other: true, }, { name: "take hangs", reports: []*report.Report{ - {Title: "A", Type: crash.KASANOther}, - {Title: "B", Type: crash.KASANOther}, + {Title: "A", Type: crash.KASANRead}, + {Title: "B", Type: crash.KASANRead}, {Title: "C", Type: crash.Hang}, {Title: "D", Type: crash.Hang}, {Title: "E", Type: crash.Hang}, {Title: "F", Type: crash.Hang}, }, // There are so many Hangs that we can't ignore it. - types: []crash.Type{crash.Hang, crash.KASANOther}, + types: []crash.Type{crash.Hang, crash.KASANRead}, report: "C", }, { diff --git a/pkg/report/crash/types.go b/pkg/report/crash/types.go index cae824161..21bc472a2 100644 --- a/pkg/report/crash/types.go +++ b/pkg/report/crash/types.go @@ -15,8 +15,8 @@ const ( DoS = Type("DoS") Hang = Type("HANG") KASANInvalidFree = Type("KASAN-INVALID-FREE") - KASANOther = Type("KASAN-OTHER") KASANRead = Type("KASAN-READ") + KASANUnknown = Type("KASAN-UNKNOWN") KASANUseAfterFreeRead = Type("KASAN-USE-AFTER-FREE-READ") KASANUseAfterFreeWrite = Type("KASAN-USE-AFTER-FREE-WRITE") KASANWrite = Type("KASAN-WRITE") @@ -51,7 +51,7 @@ type TypeGroupPred func(Type) bool func (t Type) IsKASAN() bool { return slices.Contains([]Type{ - KASANRead, KASANWrite, KASANUseAfterFreeRead, KASANUseAfterFreeWrite, KASANInvalidFree, KASANOther}, t) + KASANRead, KASANWrite, KASANUseAfterFreeRead, KASANUseAfterFreeWrite, KASANInvalidFree, KASANUnknown}, t) } func (t Type) IsKMSAN() bool { diff --git a/pkg/report/title_to_type.go b/pkg/report/title_to_type.go index fc87e4069..f5fb30e68 100644 --- a/pkg/report/title_to_type.go +++ b/pkg/report/title_to_type.go @@ -64,6 +64,7 @@ var titleToType = []struct { "KASAN: user-memory-access Read", "KASAN: vmalloc-out-of-bounds Read", "KASAN: wild-memory-access Read", + "KASAN: wild-memory-access ", // Read/Write is not clear. It is at least Read. // keep-sorting end }, crashType: crash.KASANRead, @@ -77,17 +78,18 @@ var titleToType = []struct { }, { includePrefixes: []string{ - "KASAN: slab-use-after-free Read", - "KASAN: use-after-free Read", + "KASAN: slab-use-after-free Write", + "KASAN: use-after-free Write", }, - crashType: crash.KASANUseAfterFreeRead, + crashType: crash.KASANUseAfterFreeWrite, }, { includePrefixes: []string{ - "KASAN: slab-use-after-free Write", - "KASAN: use-after-free Write", + "KASAN: slab-use-after-free Read", + "KASAN: use-after-free Read", + "KASAN: use-after-free ", // Read/Write is not clear. It is at least Read. }, - crashType: crash.KASANUseAfterFreeWrite, + crashType: crash.KASANUseAfterFreeRead, }, { includePrefixes: []string{ @@ -236,7 +238,7 @@ var titleToType = []struct { }, { includePrefixes: []string{"KASAN: "}, - crashType: crash.KASANOther, + crashType: crash.KASANUnknown, }, { includePrefixes: []string{"KFENCE: "}, diff --git a/pkg/vcs/linux_configs_test.go b/pkg/vcs/linux_configs_test.go index c5ccb9ed3..6addcbb33 100644 --- a/pkg/vcs/linux_configs_test.go +++ b/pkg/vcs/linux_configs_test.go @@ -31,14 +31,14 @@ func TestDropLinuxSanitizerConfigs(t *testing.T) { }, { name: "kasan bug", - types: []crash.Type{crash.KASANOther}, + types: []crash.Type{crash.KASANRead}, test: func(t *testing.T, cf *kconfig.ConfigFile) { assertConfigs(t, cf, "KASAN") }, }, { name: "warning & kasan bug", - types: []crash.Type{crash.Warning, crash.KASANOther}, + types: []crash.Type{crash.Warning, crash.KASANRead}, test: func(t *testing.T, cf *kconfig.ConfigFile) { assertConfigs(t, cf, "KASAN", "BUG") }, -- cgit mrf-deployment