aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/machine_info_linux.go
diff options
context:
space:
mode:
authorLiz Prucka <lizprucka@google.com>2023-04-04 17:40:44 -0500
committerAleksandr Nogikh <wp32pw@gmail.com>2023-04-24 10:52:59 +0200
commitc778c7f49050c40ff7c5e409d9b2c667483b3fc9 (patch)
tree9d1e27d3bcbddd0fb53739aba54d919ef313111a /pkg/host/machine_info_linux.go
parent2b32bd342578ed1b9cdd4720af23a16d2eca96d8 (diff)
syz-manager, pkg/cover: normalize module PCs between VM instances
Created a hash in syz-manager to map between each instance address and a stored canonical address. Translate PC coverage values when receiving inputs from VMs and when sending inputs to each VM. Signal conversion and coverage filtering will be fixed in a future commit.
Diffstat (limited to 'pkg/host/machine_info_linux.go')
-rw-r--r--pkg/host/machine_info_linux.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/host/machine_info_linux.go b/pkg/host/machine_info_linux.go
index fc3664c42..702b55cb3 100644
--- a/pkg/host/machine_info_linux.go
+++ b/pkg/host/machine_info_linux.go
@@ -127,15 +127,20 @@ func readKVMInfo(buffer *bytes.Buffer) error {
func getModulesInfo() ([]KernelModule, error) {
var modules []KernelModule
modulesText, _ := os.ReadFile("/proc/modules")
- re := regexp.MustCompile(`(\w+) .*(0[x|X][a-fA-F0-9]+)[^\n]*`)
+ re := regexp.MustCompile(`(\w+) ([0-9]+) .*(0[x|X][a-fA-F0-9]+)[^\n]*`)
for _, m := range re.FindAllSubmatch(modulesText, -1) {
- addr, err := strconv.ParseUint(string(m[2]), 0, 64)
+ addr, err := strconv.ParseUint(string(m[3]), 0, 64)
if err != nil {
return nil, fmt.Errorf("address parsing error in /proc/modules: %v", err)
}
+ size, err := strconv.ParseUint(string(m[2]), 0, 64)
+ if err != nil {
+ return nil, fmt.Errorf("module size parsing error in /proc/modules: %v", err)
+ }
modules = append(modules, KernelModule{
Name: string(m[1]),
Addr: addr,
+ Size: size,
})
}
return modules, nil