From 25e10a043498087f9427f0698b341d051c310fc4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 31 Jan 2019 10:57:46 +0100 Subject: executor: remove ability to detect kernel bugs This ability was never used but we maintain a bunch of code for it. syzkaller also recently learned to spoof this error code with some ptrace magic (probably intercepted control flow again and exploited executor binary). Drop all of it. --- pkg/ipc/ipc.go | 14 ++++---------- pkg/ipc/ipc_test.go | 11 ++--------- 2 files changed, 6 insertions(+), 19 deletions(-) (limited to 'pkg/ipc') diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go index ca0f5ac32..877fe5c06 100644 --- a/pkg/ipc/ipc.go +++ b/pkg/ipc/ipc.go @@ -121,7 +121,6 @@ const ( outputSize = 16 << 20 statusFail = 67 - statusError = 68 statusRetry = 69 // Comparison types masks taken from KCOV headers. @@ -248,10 +247,9 @@ var rateLimit = time.NewTicker(1 * time.Second) // Exec starts executor binary to execute program p and returns information about the execution: // output: process output // info: per-call info -// failed: true if executor has detected a kernel bug // hanged: program hanged and was killed -// err0: failed to start process, or executor has detected a logical error -func (env *Env) Exec(opts *ExecOpts, p *prog.Prog) (output []byte, info *ProgInfo, failed, hanged bool, err0 error) { +// err0: failed to start the process or bug in executor itself +func (env *Env) Exec(opts *ExecOpts, p *prog.Prog) (output []byte, info *ProgInfo, hanged bool, err0 error) { // Copy-in serialized program. progSize, err := p.SerializeForExec(env.in) if err != nil { @@ -282,7 +280,7 @@ func (env *Env) Exec(opts *ExecOpts, p *prog.Prog) (output []byte, info *ProgInf } } var restart bool - output, failed, hanged, restart, err0 = env.cmd.exec(opts, progData) + output, hanged, restart, err0 = env.cmd.exec(opts, progData) if err0 != nil { env.cmd.close() env.cmd = nil @@ -717,8 +715,7 @@ func (c *command) wait() error { return err } -func (c *command) exec(opts *ExecOpts, progData []byte) (output []byte, failed, hanged, - restart bool, err0 error) { +func (c *command) exec(opts *ExecOpts, progData []byte) (output []byte, hanged, restart bool, err0 error) { req := &executeReq{ magic: inMagic, envFlags: uint64(c.config.Flags), @@ -812,9 +809,6 @@ func (c *command) exec(opts *ExecOpts, progData []byte) (output []byte, failed, switch exitStatus { case statusFail: err0 = ExecutorFailure(fmt.Sprintf("executor %v: failed: %s", c.pid, output)) - case statusError: - err0 = fmt.Errorf("executor %v: detected kernel bug", c.pid) - failed = true case statusRetry: // This is a temporal error (ENOMEM) or an unfortunate // program that messes with testing setup (e.g. kills executor diff --git a/pkg/ipc/ipc_test.go b/pkg/ipc/ipc_test.go index d168a2535..8d0ca7ff5 100644 --- a/pkg/ipc/ipc_test.go +++ b/pkg/ipc/ipc_test.go @@ -96,16 +96,13 @@ func TestExecute(t *testing.T) { opts := &ExecOpts{ Flags: flag, } - output, info, failed, hanged, err := env.Exec(opts, p) + output, info, hanged, err := env.Exec(opts, p) if err != nil { t.Fatalf("failed to run executor: %v", err) } if hanged { t.Fatalf("program hanged:\n%s", output) } - if failed { - t.Fatalf("program failed:\n%s", output) - } if len(info.Calls) == 0 { t.Fatalf("no calls executed:\n%s", output) } @@ -142,7 +139,7 @@ func TestParallel(t *testing.T) { }() p := target.GenerateSimpleProg() opts := &ExecOpts{} - output, info, failed, hanged, err := env.Exec(opts, p) + output, info, hanged, err := env.Exec(opts, p) if err != nil { err = fmt.Errorf("failed to run executor: %v", err) return @@ -151,10 +148,6 @@ func TestParallel(t *testing.T) { err = fmt.Errorf("program hanged:\n%s", output) return } - if failed { - err = fmt.Errorf("program failed:\n%s", output) - return - } if len(info.Calls) == 0 { err = fmt.Errorf("no calls executed:\n%s", output) return -- cgit mrf-deployment