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_test.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'pkg/subsystem/extractor_test.go') diff --git a/pkg/subsystem/extractor_test.go b/pkg/subsystem/extractor_test.go index c2d165973..a78509e0f 100644 --- a/pkg/subsystem/extractor_test.go +++ b/pkg/subsystem/extractor_test.go @@ -13,7 +13,7 @@ import ( func TestExtractor(t *testing.T) { // Objects used in tests. fsPath := "fs/" - extProg, nfsProg := []byte("ext prog"), []byte("nfs prog") + extProg, nfsProg, extNfsProg := []byte("ext"), []byte("nfs"), []byte("ext nfs") fs := &Subsystem{Name: "fs"} ext := &Subsystem{Name: "ext", Parents: []*Subsystem{fs}} nfs := &Subsystem{Name: "nfs", Parents: []*Subsystem{fs}} @@ -46,7 +46,7 @@ func TestExtractor(t *testing.T) { want: []*Subsystem{ext}, }, { - name: `Two equally present children`, + name: `Reproducers hint at different subsystems`, crashes: []*Crash{ { GuiltyPath: fsPath, @@ -60,10 +60,10 @@ func TestExtractor(t *testing.T) { SyzRepro: nfsProg, }, }, - want: []*Subsystem{nfs, ext}, + want: []*Subsystem{fs}, }, { - name: `One child is more present than another`, + name: `One subsystem from reproducers is irrelevant`, crashes: []*Crash{ { GuiltyPath: fsPath, @@ -74,11 +74,7 @@ func TestExtractor(t *testing.T) { }, { GuiltyPath: fsPath, - SyzRepro: nfsProg, - }, - { - GuiltyPath: fsPath, - SyzRepro: extProg, + SyzRepro: extNfsProg, }, }, want: []*Subsystem{ext}, @@ -92,6 +88,7 @@ func TestExtractor(t *testing.T) { perProg: []progSubsystems{ {extProg, []*Subsystem{ext}}, {nfsProg, []*Subsystem{nfs}}, + {extNfsProg, []*Subsystem{ext, nfs}}, }, }, } -- cgit mrf-deployment