From c778c7f49050c40ff7c5e409d9b2c667483b3fc9 Mon Sep 17 00:00:00 2001 From: Liz Prucka Date: Tue, 4 Apr 2023 17:40:44 -0500 Subject: 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. --- pkg/host/machine_info_linux.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pkg/host/machine_info_linux.go') 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 -- cgit mrf-deployment