diff options
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/ipc/ipc.go | 2 | ||||
| -rw-r--r-- | pkg/runtest/run.go | 34 |
2 files changed, 23 insertions, 13 deletions
diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go index 4e41f92fe..11e73835b 100644 --- a/pkg/ipc/ipc.go +++ b/pkg/ipc/ipc.go @@ -586,6 +586,8 @@ func makeCommand(pid int, bin []string, config *Config, inFile, outFile *os.File cmd.ExtraFiles = []*os.File{inFile, outFile} } cmd.Dir = dir + // Tell ASAN to not mess with our NONFAILING. + cmd.Env = append(append([]string{}, os.Environ()...), "ASAN_OPTIONS=handle_segv=0 allow_user_segv_handler=1") cmd.Stdin = outrp cmd.Stdout = inwp if config.Flags&FlagDebug != 0 { diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go index 2730e3e02..2da871fe6 100644 --- a/pkg/runtest/run.go +++ b/pkg/runtest/run.go @@ -551,19 +551,7 @@ func parseBinOutput(req *RunRequest) ([]*ipc.ProgInfo, error) { func RunTest(req *RunRequest, executor string) { if req.Bin != "" { - tmpDir, err := ioutil.TempDir("", "syz-runtest") - if err != nil { - req.Err = fmt.Errorf("failed to create temp dir: %v", err) - return - } - defer os.RemoveAll(tmpDir) - req.Output, req.Err = osutil.RunCmd(20*time.Second, tmpDir, req.Bin) - if verr, ok := req.Err.(*osutil.VerboseError); ok { - // The process can legitimately do something like exit_group(1). - // So we ignore the error and rely on the rest of the checks (e.g. syscall return values). - req.Err = nil - req.Output = verr.Output - } + runTestC(req) return } req.Cfg.Executor = executor @@ -607,3 +595,23 @@ func RunTest(req *RunRequest, executor string) { req.Info = append(req.Info, info) } } + +func runTestC(req *RunRequest) { + tmpDir, err := ioutil.TempDir("", "syz-runtest") + if err != nil { + req.Err = fmt.Errorf("failed to create temp dir: %v", err) + return + } + defer os.RemoveAll(tmpDir) + cmd := osutil.Command(req.Bin) + cmd.Dir = tmpDir + // Tell ASAN to not mess with our NONFAILING. + cmd.Env = append(append([]string{}, os.Environ()...), "ASAN_OPTIONS=handle_segv=0 allow_user_segv_handler=1") + req.Output, req.Err = osutil.Run(20*time.Second, cmd) + if verr, ok := req.Err.(*osutil.VerboseError); ok { + // The process can legitimately do something like exit_group(1). + // So we ignore the error and rely on the rest of the checks (e.g. syscall return values). + req.Err = nil + req.Output = verr.Output + } +} |
