From b6954dce2f21b8feb1448edaaeeefc22f5ff4944 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 7 May 2024 17:04:45 +0200 Subject: pkg/vminfo: run programs interactively Use the same interfaces as the fuzzer. Now syz-manager no longer needs to treat machine check executions differently. --- pkg/ipc/ipc.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'pkg/ipc/ipc.go') diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go index 826d3068d..d87cb8b0e 100644 --- a/pkg/ipc/ipc.go +++ b/pkg/ipc/ipc.go @@ -6,6 +6,7 @@ package ipc import ( "fmt" "io" + "maps" "os" "os/exec" "path/filepath" @@ -98,6 +99,14 @@ type CallInfo struct { Errno int // call errno (0 if the call was successful) } +func (ci *CallInfo) Clone() CallInfo { + ret := *ci + ret.Signal = slices.Clone(ret.Signal) + ret.Cover = slices.Clone(ret.Cover) + ret.Comps = maps.Clone(ret.Comps) + return ret +} + type ProgInfo struct { Calls []CallInfo Extra CallInfo // stores Signal and Cover collected from background threads @@ -105,6 +114,16 @@ type ProgInfo struct { Freshness int // number of programs executed in the same process before this one } +func (pi *ProgInfo) Clone() *ProgInfo { + ret := *pi + ret.Extra = ret.Extra.Clone() + ret.Calls = slices.Clone(ret.Calls) + for i, call := range ret.Calls { + ret.Calls[i] = call.Clone() + } + return &ret +} + func EmptyProgInfo(calls int) *ProgInfo { info := &ProgInfo{Calls: make([]CallInfo, calls)} for i := range info.Calls { -- cgit mrf-deployment