From 7df4f03f0bca2ce51d72b78e2cfe3823733810aa Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 28 Mar 2023 11:51:46 +0200 Subject: pkg/subsystem: take only always present calls from repros We're not yet perfect at eliminating unneeded calls from reproducers, so let's make the subsystem extraction rules stricter: only take a subsystem from the reproducer if it's present in all reproducers. Consider more crashes (7 instead of 5) to give more opportunities to drop an unneeded call. --- pkg/subsystem/extractor.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'pkg/subsystem/extractor.go') diff --git a/pkg/subsystem/extractor.go b/pkg/subsystem/extractor.go index 075c8079d..1f635c7b3 100644 --- a/pkg/subsystem/extractor.go +++ b/pkg/subsystem/extractor.go @@ -28,12 +28,27 @@ func MakeExtractor(list []*Subsystem) *Extractor { func (e *Extractor) Extract(crashes []*Crash) []*Subsystem { // First put all subsystems to the same list. subsystems := []*Subsystem{} + reproCount := 0 for _, crash := range crashes { if crash.GuiltyPath != "" { subsystems = append(subsystems, e.raw.FromPath(crash.GuiltyPath)...) } - if len(crash.SyzRepro) > 0 { - subsystems = append(subsystems, e.raw.FromProg(crash.SyzRepro)...) + if len(crash.SyzRepro) != 0 { + reproCount++ + } + } + + // If all reproducers hint at the same subsystem, take it as well. + reproSubsystems := map[*Subsystem]int{} + for _, crash := range crashes { + if len(crash.SyzRepro) == 0 { + continue + } + for _, subsystem := range e.raw.FromProg(crash.SyzRepro) { + reproSubsystems[subsystem]++ + if reproSubsystems[subsystem] == reproCount { + subsystems = append(subsystems, subsystem) + } } } -- cgit mrf-deployment