aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem/linux/subsystems.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-01-18 18:45:55 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-10 14:34:44 +0100
commit3a4c5e2da302d43152f2e8b1362d8568c0d57e6e (patch)
tree87327b1f4d350392c22b6941a34bd4c9ae48aed9 /pkg/subsystem/linux/subsystems.go
parent8d41190df0b6184bac7d8b34765fc84395f27cf4 (diff)
pkg/subsystem/linux: determine parent-child relations
For that, extract a coincidence count matrix from a path coverage, then apply the following rule. Subsystem A is a child of B if both hold true: 1) More than 2/3 of paths that relate to A also relate to B. 2) B covers more directory tree entities than A.
Diffstat (limited to 'pkg/subsystem/linux/subsystems.go')
-rw-r--r--pkg/subsystem/linux/subsystems.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/subsystem/linux/subsystems.go b/pkg/subsystem/linux/subsystems.go
index 8d8716bf9..abda295b4 100644
--- a/pkg/subsystem/linux/subsystems.go
+++ b/pkg/subsystem/linux/subsystems.go
@@ -10,6 +10,7 @@ import (
"sort"
"github.com/google/syzkaller/pkg/subsystem/entity"
+ "github.com/google/syzkaller/pkg/subsystem/match"
)
func ListFromRepo(repo string) ([]*entity.Subsystem, error) {
@@ -86,6 +87,14 @@ func (ctx *linuxCtx) getSubsystems() ([]*entity.Subsystem, error) {
return nil, fmt.Errorf("failed to set names: %w", err)
}
ctx.applyExtraRules(ret)
+ matrix, err := match.BuildCoincidenceMatrix(ctx.root, ret, nil)
+ if err != nil {
+ return nil, err
+ }
+ err = SetParents(matrix, ret)
+ if err != nil {
+ return nil, err
+ }
return ret, nil
}