From 4459585c043faace507c685bcd9997da15809aae Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 8 Dec 2021 17:02:32 +0000 Subject: all: adapt to how mmapping a kcov instance works in Linux It turns out that the current Linux implementation of KCOV does not properly handle multiple mmap invocations on the same instance. The first one succeedes, but the subsequent ones do not actually mmap anything, yet returning no error at all. The ability to mmap that memory multiple times allows us to increase syz-executor performance and it would be a pity to completely lose it (especially given that mmapping kcov works fine on *BSD). In some time a patch will be prepared, but still we will have to support both versions at the same time - the buggy one and the correct one. Detect whether the bug is present by writing a value at the pointer returned by mmap. If it is present, disable dynamic kcov mmapping and pre-mmap 5 instances in the main() function - it should be enough for all reasonable uses. Otherwise, pre-mmap 3 and let syz-executor mmap them as needed. --- pkg/ipc/ipc.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg/ipc') diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go index f6bf3f61f..03b28e4ce 100644 --- a/pkg/ipc/ipc.go +++ b/pkg/ipc/ipc.go @@ -42,6 +42,7 @@ const ( FlagEnableDevlinkPCI // setup devlink PCI device FlagEnableVhciInjection // setup and use /dev/vhci for hci packet injection FlagEnableWifi // setup and use mac80211_hwsim for wifi emulation + FlagDelayKcovMmap // manage kcov memory in an optimized way ) // Per-exec flags for ExecOpts.Flags. -- cgit mrf-deployment