| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 fuzzCount := config.Generator.NumBinaryFuzzProcesses | 60 fuzzCount := config.Generator.NumBinaryFuzzProcesses |
| 61 if strings.HasPrefix(g.Category, "api_") { | 61 if strings.HasPrefix(g.Category, "api_") { |
| 62 fuzzCount = config.Generator.NumAPIFuzzProcesses | 62 fuzzCount = config.Generator.NumAPIFuzzProcesses |
| 63 } | 63 } |
| 64 if fuzzCount <= 0 { | 64 if fuzzCount <= 0 { |
| 65 // TODO(kjlubick): Make this actually an intelligent number base
d on the number of cores. | 65 // TODO(kjlubick): Make this actually an intelligent number base
d on the number of cores. |
| 66 fuzzCount = 4 | 66 fuzzCount = 4 |
| 67 } | 67 } |
| 68 | 68 |
| 69 » g.fuzzProcessCount = metrics2.NewCounter("afl-fuzz-process-count", map[s
tring]string{"category": g.Category}) | 69 » g.fuzzProcessCount = metrics2.GetCounter("afl-fuzz-process-count", map[s
tring]string{"category": g.Category}) |
| 70 g.fuzzProcessCount.Inc(int64(fuzzCount)) | 70 g.fuzzProcessCount.Inc(int64(fuzzCount)) |
| 71 for i := 1; i < fuzzCount; i++ { | 71 for i := 1; i < fuzzCount; i++ { |
| 72 fuzzerName := fmt.Sprintf("fuzzer%d", i) | 72 fuzzerName := fmt.Sprintf("fuzzer%d", i) |
| 73 slaveCmd := &exec.Command{ | 73 slaveCmd := &exec.Command{ |
| 74 Name: "./afl-fuzz", | 74 Name: "./afl-fuzz", |
| 75 Args: common.GenerationArgsFor(g.Category, executab
le, fuzzerName, false), | 75 Args: common.GenerationArgsFor(g.Category, executab
le, fuzzerName, false), |
| 76 Dir: config.Generator.AflRoot, | 76 Dir: config.Generator.AflRoot, |
| 77 LogStdout: true, | 77 LogStdout: true, |
| 78 LogStderr: true, | 78 LogStderr: true, |
| 79 Env: []string{"AFL_SKIP_CPUFREQ=true"}, // Avoids
a warning afl-fuzz spits out about dynamic scaling of cpu frequency | 79 Env: []string{"AFL_SKIP_CPUFREQ=true"}, // Avoids
a warning afl-fuzz spits out about dynamic scaling of cpu frequency |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 glog.Errorf("[%s] Problem downloading %s from Google Sto
rage, continuing anyway", g.Category, item.Name) | 184 glog.Errorf("[%s] Problem downloading %s from Google Sto
rage, continuing anyway", g.Category, item.Name) |
| 185 return | 185 return |
| 186 } | 186 } |
| 187 fileName := filepath.Join(seedPath, strings.SplitAfter(name, gsF
older)[1]) | 187 fileName := filepath.Join(seedPath, strings.SplitAfter(name, gsF
older)[1]) |
| 188 if err = ioutil.WriteFile(fileName, content, 0644); err != nil &
& !os.IsExist(err) { | 188 if err = ioutil.WriteFile(fileName, content, 0644); err != nil &
& !os.IsExist(err) { |
| 189 glog.Errorf("[%s] Problem creating binary seed file %s,
continuing anyway", g.Category, fileName) | 189 glog.Errorf("[%s] Problem creating binary seed file %s,
continuing anyway", g.Category, fileName) |
| 190 } | 190 } |
| 191 }) | 191 }) |
| 192 return err | 192 return err |
| 193 } | 193 } |
| OLD | NEW |