From 0d592ce46ebc504d579c07e5bc3f7f3f2038c4cf Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 15 Apr 2024 14:54:59 +0200 Subject: pkg/fuzzer: fix signal filtering during minimization This fixes 2 issues: 1. We still want to get new coverage for syscalls during minimization. We run lots of new programs, and some of them can give new coverage. 2. The signal filter should apply only to the target syscall. Other syscalls probably can't even reach any of that code. So add SignalFilterCall field and combine new and filtered signal for that call. Other calls just collect new coverage as usual. --- pkg/signal/signal.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'pkg/signal') diff --git a/pkg/signal/signal.go b/pkg/signal/signal.go index 48686de54..10a1ef0cb 100644 --- a/pkg/signal/signal.go +++ b/pkg/signal/signal.go @@ -159,11 +159,14 @@ func (s Signal) RandomSubset(r *rand.Rand, size int) Signal { return ret } -// FilterRaw returns a subset of original raw elements that coincides with the one in Signal. -func (s Signal) FilterRaw(raw []uint32) []uint32 { +// FilterRaw returns a subset of original raw elements that either are not present in ignore, +// or coincides with the one in alwaysTake. +func FilterRaw(raw []uint32, ignore, alwaysTake Signal) []uint32 { var ret []uint32 for _, e := range raw { - if _, ok := s[elemType(e)]; ok { + if _, ok := alwaysTake[elemType(e)]; ok { + ret = append(ret, e) + } else if _, ok := ignore[elemType(e)]; !ok { ret = append(ret, e) } } -- cgit mrf-deployment