Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Commit 7480774

Browse files
author
Yevgeny Pats
committed
jqf bugfixes. bumpt to v2.4.51
1 parent 3900bfd commit 7480774

File tree

5 files changed

+41
-22
lines changed

5 files changed

+41
-22
lines changed

client/agent.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ const (
2121
libFuzzerOOMExitCode = -9
2222
libFuzzerSuccessExitCode = 0
2323

24+
jqfCrashExitCode = 3
25+
jqfSuccessExitCode = 0
26+
2427
fuzzingInterval = 3600
2528
)
2629

@@ -44,6 +47,20 @@ func libFuzzerExitCodeToStatus(exitCode int) string {
4447
return status
4548
}
4649

50+
func jqfExitCodeToStatus(exitCode int) string {
51+
status := "pass"
52+
switch exitCode {
53+
case jqfCrashExitCode:
54+
status = "crash"
55+
case jqfSuccessExitCode:
56+
status = "pass"
57+
default:
58+
status = "failed"
59+
}
60+
61+
return status
62+
}
63+
4764
func appendPrefixToCmd(cmd *exec.Cmd) error {
4865
stderr, err := cmd.StderrPipe()
4966
if err != nil {
@@ -371,7 +388,7 @@ func (c *FuzzitClient) RunJQFFuzzing() error {
371388
"-jar",
372389
"zest-cli.jar",
373390
"--exit-on-crash",
374-
"--exact-crash-path=crash",
391+
"--exact-crash-path=artifact",
375392
"--libfuzzer-compat-output",
376393
"fuzzer",
377394
}
@@ -458,7 +475,7 @@ func (c *FuzzitClient) RunJQFFuzzing() error {
458475
return err
459476
}
460477

461-
err = c.transitionStatus(libFuzzerExitCodeToStatus(exitCode))
478+
err = c.transitionStatus(jqfExitCodeToStatus(exitCode))
462479
if err != nil {
463480
return err
464481
}

client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
const FuzzitEndpoint = "https://app.fuzzit.dev"
11-
const Version = "v2.4.50"
11+
const Version = "v2.4.51"
1212

1313
type Target struct {
1414
Name string `firestore:"target_name"`

client/commands.go

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,8 @@ func (c *FuzzitClient) CreateLocalJob(jobConfig Job, files []string) error {
206206
return err
207207
}
208208

209-
log.Println("Pulling container")
210-
image := HostToDocker[jobConfig.Host]
211-
if image == "" {
212-
if jobConfig.Host == "" {
213-
if jobConfig.Engine == "jqf" {
214-
image = "openjdk:stretch"
215-
} else {
216-
image = "gcr.io/fuzzit-public/stretch-llvm8:64bdedf"
217-
}
218-
} else {
219-
image = jobConfig.Host
220-
}
221-
}
222-
log.Printf("running regression in image: %s\n", image)
223-
reader, err := cli.ImagePull(ctx, image, types.ImagePullOptions{})
209+
log.Printf("Pulling container %s\n", jobConfig.Host)
210+
reader, err := cli.ImagePull(ctx, jobConfig.Host, types.ImagePullOptions{})
224211
if err != nil {
225212
return err
226213
}
@@ -229,7 +216,6 @@ func (c *FuzzitClient) CreateLocalJob(jobConfig Job, files []string) error {
229216
return err
230217
}
231218
log.Println("Creating container")
232-
log.Printf("org=%s\n", c.Org)
233219
createdContainer, err := cli.ContainerCreate(ctx,
234220
&container.Config{
235221
Env: append(
@@ -239,15 +225,16 @@ func (c *FuzzitClient) CreateLocalJob(jobConfig Job, files []string) error {
239225
"FUZZIT_API_KEY=" + c.ApiKey,
240226
},
241227
jobConfig.EnvironmentVariables...),
242-
Image: image,
228+
Image: jobConfig.Host,
229+
WorkingDir: "/app",
243230
Cmd: []string{
244231
"/bin/sh",
245232
"-c",
246233
fmt.Sprintf(`cd /app
247234
echo "Downloading fuzzit cli/agent..."
248235
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/%s/fuzzit_Linux_x86_64
249236
chmod a+x fuzzit
250-
./fuzzit run --type regression %s %s`, Version, c.Org, jobConfig.TargetId),
237+
./fuzzit run --engine "%s" --type regression --args "%s" %s %s`, Version, jobConfig.Engine, jobConfig.Args, c.Org, jobConfig.TargetId),
251238
},
252239
AttachStdin: true,
253240
},

client/commands_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func TestCreateLocalJob(t *testing.T) {
8585
t.Run(fmt.Sprintf("target:%s, err:%s", tc.target, tc.err), func(t *testing.T) {
8686
newJob.Type = "regression"
8787
newJob.TargetId = tc.target
88+
newJob.Host = "gcr.io/fuzzit-public/stretch-llvm8:64bdedf"
8889
err := tc.client.CreateLocalJob(newJob, []string{"testdata/fuzzer.tar.gz"})
8990
if err != nil {
9091
if err.Error() != tc.err {

cmd/job.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ var jobCmd = &cobra.Command{
4141
log.Fatalf("--engine should be either libfuzzer or jqf. Recieved: %s", newJob.Type)
4242
}
4343

44+
image := client.HostToDocker[newJob.Host]
45+
if image == "" {
46+
if newJob.Host == "" {
47+
if newJob.Engine == "jqf" {
48+
image = "openjdk:stretch"
49+
} else {
50+
image = "gcr.io/fuzzit-public/stretch-llvm8:64bdedf"
51+
}
52+
} else {
53+
image = newJob.Host
54+
}
55+
}
56+
newJob.Host = image
57+
4458
skipIfNotExist, err := cmd.Flags().GetBool("skip-if-not-exists")
4559
if err != nil {
4660
log.Fatal(err)
@@ -97,7 +111,7 @@ func init() {
97111
jobCmd.Flags().Uint16Var(&newJob.Parallelism, "cpus", 1, "number of cpus to use (only relevant for fuzzing job)")
98112
jobCmd.Flags().StringVar(&newJob.Revision, "revision", revision, "Revision tag of fuzzer (populates automatically from git,travis,circleci)")
99113
jobCmd.Flags().StringVar(&newJob.Branch, "branch", branch, "Branch of the fuzzer (populates automatically from git,travis,circleci)")
100-
jobCmd.Flags().StringVar(&newJob.Host, "host", "stretch-llvm8", "docker image to use when running the fuzzer. Options: stretch-llvm8/stretch-llvm9/bionic-swift51")
114+
jobCmd.Flags().StringVar(&newJob.Host, "host", "", "docker image to use when running the fuzzer. Options: stretch-llvm8/stretch-llvm9/bionic-swift51")
101115
jobCmd.Flags().StringArrayVarP(&newJob.EnvironmentVariables, "environment", "e", nil,
102116
"Additional environment variables for the fuzzer. For example ASAN_OPTINOS, UBSAN_OPTIONS or any other")
103117
jobCmd.Flags().StringVar(&newJob.Args, "args", "", "Additional runtime args for the fuzzer")

0 commit comments

Comments
 (0)