aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem/raw_extractor.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-02-10 12:14:36 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-10 14:34:44 +0100
commit95871dcc45f6531b4c692ff892aad56bdd95e16f (patch)
tree95c8ffe8b8a36b1dc9473cc3a07e7286595e0b2f /pkg/subsystem/raw_extractor.go
parent0ee9f5fa4e372b5a2da4ac27418e6c5bccbcaf7a (diff)
pkg/subsystem: restructure the package
Remove the entity and match subpackages. Regenerate the linux.go file.
Diffstat (limited to 'pkg/subsystem/raw_extractor.go')
-rw-r--r--pkg/subsystem/raw_extractor.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/pkg/subsystem/raw_extractor.go b/pkg/subsystem/raw_extractor.go
index 4a86b1f6b..fa964fd25 100644
--- a/pkg/subsystem/raw_extractor.go
+++ b/pkg/subsystem/raw_extractor.go
@@ -4,21 +4,19 @@
package subsystem
import (
- "github.com/google/syzkaller/pkg/subsystem/entity"
- "github.com/google/syzkaller/pkg/subsystem/match"
"github.com/google/syzkaller/prog"
)
// rawExtractor performs low-level subsystem matching (directly by a path or a syscall).
type rawExtractor struct {
- matcher *match.PathMatcher
- perCall map[string][]*entity.Subsystem
+ matcher *PathMatcher
+ perCall map[string][]*Subsystem
}
-func makeRawExtractor(list []*entity.Subsystem) *rawExtractor {
+func makeRawExtractor(list []*Subsystem) *rawExtractor {
ret := &rawExtractor{
- matcher: match.MakePathMatcher(list),
- perCall: make(map[string][]*entity.Subsystem),
+ matcher: MakePathMatcher(list),
+ perCall: make(map[string][]*Subsystem),
}
for _, subsystem := range list {
for _, call := range subsystem.Syscalls {
@@ -28,19 +26,19 @@ func makeRawExtractor(list []*entity.Subsystem) *rawExtractor {
return ret
}
-func (e *rawExtractor) FromPath(path string) []*entity.Subsystem {
+func (e *rawExtractor) FromPath(path string) []*Subsystem {
return e.matcher.Match(path)
}
-func (e *rawExtractor) FromProg(progBytes []byte) []*entity.Subsystem {
- calls := make(map[*entity.Subsystem]struct{})
+func (e *rawExtractor) FromProg(progBytes []byte) []*Subsystem {
+ calls := make(map[*Subsystem]struct{})
progCalls, _, _ := prog.CallSet(progBytes)
for call := range progCalls {
for _, subsystem := range e.perCall[call] {
calls[subsystem] = struct{}{}
}
}
- list := []*entity.Subsystem{}
+ list := []*Subsystem{}
for key := range calls {
list = append(list, key)
}