From 3a4c5e2da302d43152f2e8b1362d8568c0d57e6e Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 18 Jan 2023 18:45:55 +0100 Subject: 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. --- pkg/subsystem/linux/subsystems.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pkg/subsystem/linux/subsystems.go') 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 } -- cgit mrf-deployment