aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem/linux
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-01-31 13:38:10 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-10 14:34:44 +0100
commitad871703d4fcd9ed84544dd6f5c4221aa5df5feb (patch)
treee56c0441a09c3d6d3cd90ec9e290b9abe65f3d82 /pkg/subsystem/linux
parent9a724c34f06b47f05b36c5292b107e9b06048667 (diff)
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.
Diffstat (limited to 'pkg/subsystem/linux')
-rw-r--r--pkg/subsystem/linux/parents.go17
1 files changed, 1 insertions, 16 deletions
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 {