aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-02-19 16:54:32 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-02-21 14:46:51 +0000
commit9e510875d0a1ba4a9c3a4ae06e29bdc8864f1d74 (patch)
tree605ff085c8e3d8376de84a461c047bc86aaf3369 /pkg
parent3eb4f0c2a392b15406af944af98065c12634affd (diff)
pkg/ipc: copy signal and coverage
We used to optimize the memory usage by making the slices of individual CallInfo structs point to the shared memory buffer between syz-fuzzer and executor. However, this puts very strict expectations on all pkg/ipc users and complicates the decoupling of the fuzzing logic from individual proc loops. Let's try to live without this optimization. When compared with the cost of a single syz-executor execution, the cost of array copying is very very small anyway.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/ipc/ipc.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go
index fd95d63d5..c90e56caf 100644
--- a/pkg/ipc/ipc.go
+++ b/pkg/ipc/ipc.go
@@ -493,13 +493,17 @@ func readUint32Array(outp *[]byte, size uint32) ([]uint32, bool) {
if int(size)*4 > len(out) {
return nil, false
}
+ // "Convert" the data to uint32.
var res []uint32
hdr := (*reflect.SliceHeader)((unsafe.Pointer(&res)))
hdr.Data = uintptr(unsafe.Pointer(&out[0]))
hdr.Len = int(size)
hdr.Cap = int(size)
*outp = out[size*4:]
- return res, true
+ // Now duplicate the resulting array.
+ dupRes := make([]uint32, size)
+ copy(dupRes, res)
+ return dupRes, true
}
type command struct {