aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/mgrconfig
diff options
context:
space:
mode:
authorJoey Jiao <joeyjiaojg@gmail.com>2021-03-02 09:31:32 +0800
committerDmitry Vyukov <dvyukov@google.com>2021-03-05 20:05:43 +0100
commit69a06ca2b532ff4021a43fdead4e2ac1452a44c0 (patch)
tree3ed7ff70026f51ff0a8f980b5967daeb30bcad71 /pkg/mgrconfig
parent800618b02f4f840756eb4218603a313113f94f05 (diff)
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 } ]
Diffstat (limited to 'pkg/mgrconfig')
-rw-r--r--pkg/mgrconfig/config.go18
1 files changed, 18 insertions, 0 deletions
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)