diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-11-25 12:03:30 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-11-25 14:12:10 +0000 |
| commit | 02832ca35ded902878eb2a3aa43a1235de5f8ac4 (patch) | |
| tree | d9f362983f5df58518549650bc27806853b38b6f /pkg/vminfo/linux.go | |
| parent | a84878fcfef572bb166d73bcc5974ea50a3fde64 (diff) | |
pkg/vminfo: refactor few things
Use default nop implementation for most openbsd/netbsd methods.
Move linux-specific vm type checks to linux code.
Remove indirection for CheckFiles as we have for RequiredFiles.
Diffstat (limited to 'pkg/vminfo/linux.go')
| -rw-r--r-- | pkg/vminfo/linux.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pkg/vminfo/linux.go b/pkg/vminfo/linux.go index 0f598515c..52f6982b2 100644 --- a/pkg/vminfo/linux.go +++ b/pkg/vminfo/linux.go @@ -13,9 +13,13 @@ import ( "sort" "strconv" "strings" + + "github.com/google/syzkaller/sys/targets" ) -type linux int +type linux struct { + vmType string +} func (linux) RequiredFiles() []string { return []string{ @@ -27,7 +31,7 @@ func (linux) RequiredFiles() []string { } } -func (linux) checkFiles() []string { +func (linux) CheckFiles() []string { return []string{ "/proc/version", "/proc/filesystems", @@ -42,7 +46,10 @@ func (linux) machineInfos() []machineInfoFunc { } } -func (linux) parseModules(files filesystem) ([]*KernelModule, error) { +func (linux linux) parseModules(files filesystem) ([]*KernelModule, error) { + if linux.vmType == targets.GVisor || linux.vmType == targets.Starnix { + return nil, nil + } var modules []*KernelModule re := regexp.MustCompile(`(\w+) ([0-9]+) .*(0[x|X][a-fA-F0-9]+)[^\n]*`) modulesText, _ := files.ReadFile("/proc/modules") |
