]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.fuzz] internal/fuzz: worker exiting 0 should not be a crasher
authorJay Conrod <jayconrod@google.com>
Tue, 9 Feb 2021 15:23:40 +0000 (10:23 -0500)
committerJay Conrod <jayconrod@google.com>
Wed, 10 Feb 2021 18:20:47 +0000 (18:20 +0000)
If a worker process exits with status 0, treat it as a communication
error. Previously, we treated this as a crasher, but it seems more
likely to be caused by a bug in the fuzz function rather than a bug in
the code being tested.

Change-Id: I0c4efeaef85537f8a0e9c6def6aac41d75b2b307
Reviewed-on: https://go-review.googlesource.com/c/go/+/290690
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
src/internal/fuzz/worker.go

index 8ea95438cab93b00ad0582730dfec47b08b83d03..9a92813f8ca76a7146e7f3e6832c3f8fdb735049 100644 (file)
@@ -96,6 +96,11 @@ func (w *worker) runFuzzing() error {
                                w.stop()
                                return nil
                        }
+                       if w.waitErr == nil {
+                               // Worker exited 0.
+                               w.stop()
+                               return fmt.Errorf("worker exited unexpectedly with status 0")
+                       }
 
                        // Unexpected termination. Inform the coordinator about the crash.
                        // TODO(jayconrod,katiehockman): if -keepfuzzing, restart worker.
@@ -108,11 +113,7 @@ func (w *worker) runFuzzing() error {
                                errMsg:      message,
                        }
                        w.coordinator.crasherC <- crasher
-                       err := w.stop()
-                       if err == nil {
-                               err = fmt.Errorf("worker exited unexpectedly")
-                       }
-                       return err
+                       return w.stop()
 
                case input := <-inputC:
                        // Received input from coordinator.