From 4cd91fc0b5007710bf0f38de6319ce24c31a52e5 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 15 Apr 2024 14:54:59 +0200 Subject: pkg/ipc: pass only exec encoding to Exec Does not require passing text program to ipc.Env.Exec. Make it possible to provide just the exec encoding. This requires moving fallback coverage to the host since it need the program. --- tools/syz-execprog/execprog.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/syz-execprog/execprog.go b/tools/syz-execprog/execprog.go index d2d194da2..6bcc92a07 100644 --- a/tools/syz-execprog/execprog.go +++ b/tools/syz-execprog/execprog.go @@ -176,10 +176,18 @@ func (ctx *Context) execute(pid int, env *ipc.Env, p *prog.Prog, progIndex int) if *flagOutput { ctx.logProgram(pid, p, callOpts) } + progData, err := p.SerializeForExec() + if err != nil { + log.Logf(1, "RESULT: failed to serialize: %v", err) + return + } // This mimics the syz-fuzzer logic. This is important for reproduction. for try := 0; ; try++ { - output, info, hanged, err := env.Exec(callOpts, p) - if err != nil && err != prog.ErrExecBufferTooSmall { + output, info, hanged, err := env.ExecProg(callOpts, progData) + if err != nil { + if ctx.config.Flags&ipc.FlagDebug != 0 { + log.Logf(0, "result: hanged=%v err=%v\n\n%s", hanged, err, output) + } if try > 10 { log.SyzFatalf("executor %d failed %d times: %v\n%s", pid, try, err, output) } @@ -190,9 +198,6 @@ func (ctx *Context) execute(pid int, env *ipc.Env, p *prog.Prog, progIndex int) } continue } - if ctx.config.Flags&ipc.FlagDebug != 0 || err != nil { - log.Logf(0, "result: hanged=%v err=%v\n\n%s", hanged, err, output) - } if info != nil { ctx.printCallResults(info) if *flagHints { -- cgit mrf-deployment