From 69a06ca2b532ff4021a43fdead4e2ac1452a44c0 Mon Sep 17 00:00:00 2001 From: Joey Jiao Date: Tue, 2 Mar 2021 09:31:32 +0800 Subject: all: add KernelModule cfg to show DLKM coverage PC returned for dynamic loaded module (DLKM) is not parsed in coverage page. So the commit is to use DLKM modules' load address to restore the PC and show coverage data of DLKM. As the load address is written in cfg file, so kaslr needs to be disabled. And for linux target, load address is getting from /proc/modules during instance setup. For either manual or auto address setting case, name and path are needed in config kernel_modules, where name is module name on target. path is module unstripped object path on host. addr is decimal value of module load address on target. Example of config: "kernel_modules": [ { "name": "nf_nat", "path": "/usr/src/linux-source/net/netfilter/nf_nat.ko", "addr": 18446744072637911040 } ] --- pkg/mgrconfig/config.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'pkg/mgrconfig') diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go index e4bfc46f8..a5ab47590 100644 --- a/pkg/mgrconfig/config.go +++ b/pkg/mgrconfig/config.go @@ -5,7 +5,9 @@ package mgrconfig import ( "encoding/json" + "github.com/google/syzkaller/pkg/cover" + "github.com/google/syzkaller/pkg/cover/backend" ) type Config struct { @@ -40,6 +42,22 @@ type Config struct { // Directory with kernel object files (e.g. `vmlinux` for linux) // (used for report symbolization and coverage reports, optional). KernelObj string `json:"kernel_obj"` + // Map of kernel modules' symbol files and load address. + // path is unstripped module obj path and + // addr (uint64) is the module load address on target, + // like 'button 16384 0 - Live 0xffffffffc0163000', + // addr is 18446744072637263872 of 0xffffffffc0163000 above. + // For linux target, the addr is getting from /proc/modules + // automatically during instance run. + // Example config: + // "kernel_modules": [ + // { + // "name": "wlan", + // "path": "../../wlan.ko.unstripped", + // "addr": 18446744072637911040 + // } + // ] + KernelModules []backend.KernelModule `json:"kernel_modules"` // Kernel source directory (if not set defaults to KernelObj). KernelSrc string `json:"kernel_src,omitempty"` // Location of the driectory where the kernel was built (if not set defaults to KernelSrc) -- cgit mrf-deployment