diff options
| author | Michael Pratt <mpratt@google.com> | 2017-05-26 16:11:19 -0700 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2017-05-30 09:33:51 -0700 |
| commit | 29fc5b76cdfa2f32e7965f54aeb28356b93f3704 (patch) | |
| tree | 28d1ae8bd5bc68a62ab219b609c257866fcceca4 /ipc | |
| parent | 75b66eabef6ee2b89d89f31d90ff2ed9d3478c39 (diff) | |
all: cleanup executor/ipc status checking
This is mostly a cleanup change with little functional change.
In ipc.command.exec, remove the status fallback from the pipe to the
exit status. Once the executor is serving, it always writes the status
over the pipe; anything else is an error.
Remove the panic check in syz-stress, which is no longer needed.
Diffstat (limited to 'ipc')
| -rw-r--r-- | ipc/ipc.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ipc/ipc.go b/ipc/ipc.go index ce951aab6..5d579b479 100644 --- a/ipc/ipc.go +++ b/ipc/ipc.go @@ -617,36 +617,28 @@ func (c *command) exec(opts *ExecOpts) (output []byte, failed, hanged, restart b } status = int(reply[0]) if status == 0 { + // Program was OK. <-hang return } // Executor writes magic values into the pipe before exiting, // so proceed with killing and joining it. - status = int(reply[0]) } - err0 = fmt.Errorf("executor did not answer") c.abort() output = <-c.readDone - if err := c.wait(); <-hang && err != nil { + if err := c.wait(); <-hang { hanged = true + // In all likelihood, this will be duplicated by the default + // case below, but that's fine. output = append(output, []byte(err.Error())...) output = append(output, '\n') } - switch status { - case statusFail, statusError, statusRetry: - default: - if c.cmd.ProcessState != nil { - sys := c.cmd.ProcessState.Sys() - if ws, ok := sys.(syscall.WaitStatus); ok { - status = ws.ExitStatus() - } - } - } // Handle magic values returned by executor. switch status { case statusFail: err0 = ExecutorFailure(fmt.Sprintf("executor failed: %s", output)) case statusError: + err0 = fmt.Errorf("executor detected kernel bug") failed = true case statusRetry: // This is a temporal error (ENOMEM) or an unfortunate @@ -656,6 +648,14 @@ func (c *command) exec(opts *ExecOpts) (output []byte, failed, hanged, restart b err0 = nil hanged = false restart = true + default: + // Failed to get a valid (or perhaps any) status from the + // executor. + // + // Once the executor is serving the status is always written to + // the pipe, so we don't bother to check the specific exit + // codes from wait. + err0 = fmt.Errorf("invalid (or no) executor status received: %d, executor exit: %s", status, c.cmd.ProcessState) } return } |
