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-05-02 11:49:49 +0200
commit30fd060991c8376c9c4296565809d6ffe482c0ca (patch)
treee8b73a2c9fea70cb160ee2a0c4b1e04f10d56e88 /pkg/host/machine_info_linux.go
parent52d40fd252bb12a2d5ec5573ce4d03b63682dfdc (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. Edit from last (reverted) PR: added a check to confirm fuzzer has been instantiated before canonicalization.
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