| OLD | NEW |
| 1 package generator | 1 package generator |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "fmt" | 4 "fmt" |
| 5 "io/ioutil" | 5 "io/ioutil" |
| 6 "os" | 6 "os" |
| 7 "path/filepath" | 7 "path/filepath" |
| 8 "strings" | 8 "strings" |
| 9 | 9 |
| 10 "github.com/skia-dev/glog" | 10 "github.com/skia-dev/glog" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 return &Generator{ | 27 return &Generator{ |
| 28 Category: category, | 28 Category: category, |
| 29 fuzzProcesses: nil, | 29 fuzzProcesses: nil, |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 // Start starts up 1 goroutine running a "master" afl-fuzz and n-1 "slave" afl-f
uzz processes, where | 33 // Start starts up 1 goroutine running a "master" afl-fuzz and n-1 "slave" afl-f
uzz processes, where |
| 34 // n is specified by config.Generator.NumFuzzProcesses. Output goes to | 34 // n is specified by config.Generator.NumFuzzProcesses. Output goes to |
| 35 // config.Generator.AflOutputPath/[category]. | 35 // config.Generator.AflOutputPath/[category]. |
| 36 func (g *Generator) Start() error { | 36 func (g *Generator) Start() error { |
| 37 if config.Generator.SkipGeneration { |
| 38 glog.Info("Skipping generation because flag was set.") |
| 39 return nil |
| 40 } |
| 37 executable, err := g.setup() | 41 executable, err := g.setup() |
| 38 if err != nil { | 42 if err != nil { |
| 39 return fmt.Errorf("Failed %s generator setup: %s", g.Category, e
rr) | 43 return fmt.Errorf("Failed %s generator setup: %s", g.Category, e
rr) |
| 40 } | 44 } |
| 41 | 45 |
| 42 masterCmd := &exec.Command{ | 46 masterCmd := &exec.Command{ |
| 43 Name: "./afl-fuzz", | 47 Name: "./afl-fuzz", |
| 44 Args: common.GenerationArgsFor(g.Category, executable, "fuz
zer0", true), | 48 Args: common.GenerationArgsFor(g.Category, executable, "fuz
zer0", true), |
| 45 Dir: config.Generator.AflRoot, | 49 Dir: config.Generator.AflRoot, |
| 46 LogStdout: true, | 50 LogStdout: true, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 glog.Errorf("[%s] Problem downloading %s from Google Sto
rage, continuing anyway", g.Category, item.Name) | 175 glog.Errorf("[%s] Problem downloading %s from Google Sto
rage, continuing anyway", g.Category, item.Name) |
| 172 return | 176 return |
| 173 } | 177 } |
| 174 fileName := filepath.Join(seedPath, strings.SplitAfter(name, gsF
older)[1]) | 178 fileName := filepath.Join(seedPath, strings.SplitAfter(name, gsF
older)[1]) |
| 175 if err = ioutil.WriteFile(fileName, content, 0644); err != nil &
& !os.IsExist(err) { | 179 if err = ioutil.WriteFile(fileName, content, 0644); err != nil &
& !os.IsExist(err) { |
| 176 glog.Errorf("[%s] Problem creating binary seed file %s,
continuing anyway", g.Category, fileName) | 180 glog.Errorf("[%s] Problem creating binary seed file %s,
continuing anyway", g.Category, fileName) |
| 177 } | 181 } |
| 178 }) | 182 }) |
| 179 return err | 183 return err |
| 180 } | 184 } |
| OLD | NEW |