From ad871703d4fcd9ed84544dd6f5c4221aa5df5feb Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 31 Jan 2023 13:38:10 +0100 Subject: pkg/subsystem: extract subsystems from a crash list For now, let's use a straightforward approach: 1) Extract all subsystems for each guilty path and syz reproducer. 2) If there are both parents and children in the list, remove parents. 3) Count the remaining subsystems. 4) Pick the ones that appear most often. --- pkg/subsystem/linux/parents.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'pkg/subsystem/linux') diff --git a/pkg/subsystem/linux/parents.go b/pkg/subsystem/linux/parents.go index 40ba10b7f..5c66782c1 100644 --- a/pkg/subsystem/linux/parents.go +++ b/pkg/subsystem/linux/parents.go @@ -35,8 +35,7 @@ func transitiveReduction(list []*entity.Subsystem) { for _, s := range list { removeParents := map[*entity.Subsystem]bool{} for _, p := range s.Parents { - reachable := reachableParents(p) - for otherP := range reachable { + for otherP := range p.ReachableParents() { removeParents[otherP] = true } } @@ -50,20 +49,6 @@ func transitiveReduction(list []*entity.Subsystem) { } } -// reachableParents lists all entity.Subsystem entries reachable from the given one. -func reachableParents(start *entity.Subsystem) map[*entity.Subsystem]bool { - ret := make(map[*entity.Subsystem]bool) - var dfs func(node *entity.Subsystem) - dfs = func(node *entity.Subsystem) { - for _, p := range node.Parents { - ret[p] = true - dfs(p) - } - } - dfs(start) - return ret -} - // loopsExist is a helper method that verifies that the resulting graph has no loops. func loopsExist(list []*entity.Subsystem) bool { type graphNode struct { -- cgit mrf-deployment