diff --git a/.github/workflows/run_fuzzer.yml b/.github/workflows/run_fuzzer.yml index 37b17b950..bae95c1e2 100644 --- a/.github/workflows/run_fuzzer.yml +++ b/.github/workflows/run_fuzzer.yml @@ -23,8 +23,7 @@ jobs: id: cache-corpus with: path: head/fuzzing/corpus.tar - key: corpus-${{ github.run_id }} - restore-keys: corpus- + key: corpus - name: Install packages shell: bash run: | @@ -55,6 +54,9 @@ jobs: ls -al /usr/lib/llvm-18/lib/clang/18/lib/linux/"$(basename ${f%.*})"-x86_64.a done fi + - name: Check fuzzing dir + run: | + ls -al head/fuzzing/ - uses: ./head/.github/actions/build with: buildtype: 'boost' @@ -63,9 +65,11 @@ jobs: cxxstd: 17 targets: libs/json/fuzzing//run - name: Pack the corpus - working-directory: boost-root/libs/json/fuzzing/ + working-directory: boost-root/libs/json/fuzzing/cmin run: | - tar cf - cmin > corpus.tar.tmp && mv corpus.tar.tmp "${GITHUB_WORKSPACE}"/head/fuzzing + tar cf - * > "$GITHUB_WORKSPACE"/head/fuzzing/corpus.tar + ls -al . + tar -tf "$GITHUB_WORKSPACE"/head/fuzzing/corpus.tar - name: Save the corpus as a github artifact uses: actions/upload-artifact@v4 if: success() diff --git a/fuzzing/Jamfile b/fuzzing/Jamfile index 0eef94aca..c2dda9883 100644 --- a/fuzzing/Jamfile +++ b/fuzzing/Jamfile @@ -39,32 +39,31 @@ import testing ; ] ; local corpus.tar = [ glob-ex . : corpus.tar ] ; +local test-corpus ; if $(corpus.tar) { # if an old corpus exists, use it - # get it with curl -O --location -J https://bintray.com/pauldreik/boost.json/download_file?file_path=corpus%2Fcorpus.tar make old-corpus : $(corpus.tar) : @untar-corpus : oldcorpus ; + explicit old-corpus ; } else { - alias old-corpus ; + test-corpus = [ glob-tree-ex ../test : *.json ] ; } -explicit old-corpus ; - - -local initial-corpus = [ glob-tree-ex ../test : *.json ] ; +local old-runs = [ SORT [ glob-tree-ex old_crashes : * ] ] ; +make old_crashes : : common.MkDir : . ; +explicit old_crashes ; local variants = basic_parser parse parser direct_parse ; for local variant in basic_parser parse parser direct_parse { local $(variant)-runs ; local fuzzer = fuzzer_$(variant) ; - lib $(fuzzer) : fuzz_$(variant).cpp /boost/json//boost_json ; exe $(fuzzer) : fuzz_$(variant).cpp /boost/json//json_sources : requirements @@ -73,44 +72,44 @@ for local variant in basic_parser parse parser direct_parse ; # make sure the old crashes pass without problems - local old-runs = [ glob-tree-ex old_crashes/$(variant) : * ] ; if $(old-runs) { run $(fuzzer) : target-name $(variant)-run-crashes - : input-files [ SORT $(old-runs) ] + : input-files $(old-runs) ; + explicit $(variant)-run-crashes ; $(variant)-runs += $(variant)-run-crashes ; } - make oldcorpus/$(variant) - : old-corpus - : common.MkDir - : . - ; - explicit oldcorpus/$(variant) ; - - # make an initial corpus from the test data already in the repo - local seed-corpus ; - for file in $(initial-corpus) + local old-corpus-deps ; + if $(corpus.tar) { - local copied = $(variant)/$(file:D=) ; - make $(copied) : $(file) : common.copy : seedcorpus ; - explicit $(copied) ; - seed-corpus += $(copied) ; + old-corpus-deps = old-corpus ; } - make seedcorpus/$(variant) - : $(seed-corpus) + else + { + # make an initial corpus from the test data already in the repo + for file in $(test-corpus) + { + local copied = $(variant)/$(file:D=) ; + make $(copied) : $(file) : common.copy : oldcorpus ; + explicit $(copied) ; + old-corpus-deps += $(copied) ; + } + } + make oldcorpus/$(variant) + : $(old-corpus-deps) : common.MkDir : . ; - explicit seedcorpus/$(variant) ; + explicit oldcorpus/$(variant) ; # run the fuzzer for a short while make out/$(variant) : $(fuzzer) oldcorpus/$(variant) - seedcorpus/$(variant) + old_crashes : @run-fuzzer : . $(.MAXTIME) @@ -122,8 +121,9 @@ for local variant in basic_parser parse parser direct_parse # minimize the corpus make cmin/$(variant) : $(fuzzer) - oldcorpus/$(variant) out/$(variant) + oldcorpus/$(variant) + old_crashes : @run-fuzzer : . -merge=1 @@ -178,7 +178,7 @@ rule run-fuzzer ( target : sources * : props * ) actions run-fuzzer { $(.UBSAN_OPTIONS) - $(>[1]) $(<) $(>[2]) $(>[3]) $(FLAGS) + $(>[1]) $(<) $(>[2-]) $(FLAGS) } .TOUCH_FILE = [ common.file-touch-command ] ; diff --git a/fuzzing/old_crashes/basic_parser/20200903.json b/fuzzing/old_crashes/20200903.json similarity index 100% rename from fuzzing/old_crashes/basic_parser/20200903.json rename to fuzzing/old_crashes/20200903.json diff --git a/fuzzing/old_crashes/direct_parse/array.json b/fuzzing/old_crashes/array.json similarity index 100% rename from fuzzing/old_crashes/direct_parse/array.json rename to fuzzing/old_crashes/array.json diff --git a/fuzzing/old_crashes/parser/clusterfuzz-testcase-minimized-fuzz_parser-4763163676508160 b/fuzzing/old_crashes/clusterfuzz-testcase-minimized-fuzz_parser-4763163676508160 similarity index 100% rename from fuzzing/old_crashes/parser/clusterfuzz-testcase-minimized-fuzz_parser-4763163676508160 rename to fuzzing/old_crashes/clusterfuzz-testcase-minimized-fuzz_parser-4763163676508160 diff --git a/fuzzing/old_crashes/parser/clusterfuzz-testcase-minimized-fuzz_parser-6038712407425024 b/fuzzing/old_crashes/clusterfuzz-testcase-minimized-fuzz_parser-6038712407425024 similarity index 100% rename from fuzzing/old_crashes/parser/clusterfuzz-testcase-minimized-fuzz_parser-6038712407425024 rename to fuzzing/old_crashes/clusterfuzz-testcase-minimized-fuzz_parser-6038712407425024 diff --git a/fuzzing/old_crashes/parser/clusterfuzz-testcase-minimized-fuzz_parser-6157345913700352 b/fuzzing/old_crashes/clusterfuzz-testcase-minimized-fuzz_parser-6157345913700352 similarity index 100% rename from fuzzing/old_crashes/parser/clusterfuzz-testcase-minimized-fuzz_parser-6157345913700352 rename to fuzzing/old_crashes/clusterfuzz-testcase-minimized-fuzz_parser-6157345913700352 diff --git a/fuzzing/old_crashes/basic_parser/crash_00.json b/fuzzing/old_crashes/crash_00.json similarity index 100% rename from fuzzing/old_crashes/basic_parser/crash_00.json rename to fuzzing/old_crashes/crash_00.json diff --git a/fuzzing/old_crashes/basic_parser/crash_01.json b/fuzzing/old_crashes/crash_01.json similarity index 100% rename from fuzzing/old_crashes/basic_parser/crash_01.json rename to fuzzing/old_crashes/crash_01.json diff --git a/fuzzing/old_crashes/basic_parser/gh13_1.json b/fuzzing/old_crashes/gh13_1.json similarity index 100% rename from fuzzing/old_crashes/basic_parser/gh13_1.json rename to fuzzing/old_crashes/gh13_1.json diff --git a/fuzzing/old_crashes/basic_parser/gh13_3.json b/fuzzing/old_crashes/gh13_3.json similarity index 100% rename from fuzzing/old_crashes/basic_parser/gh13_3.json rename to fuzzing/old_crashes/gh13_3.json diff --git a/fuzzing/old_crashes/basic_parser/gh20_0.json b/fuzzing/old_crashes/gh20_0.json similarity index 100% rename from fuzzing/old_crashes/basic_parser/gh20_0.json rename to fuzzing/old_crashes/gh20_0.json diff --git a/fuzzing/old_crashes/basic_parser/gh21_0.json b/fuzzing/old_crashes/gh21_0.json similarity index 100% rename from fuzzing/old_crashes/basic_parser/gh21_0.json rename to fuzzing/old_crashes/gh21_0.json diff --git a/fuzzing/old_crashes/parse/gh221.json b/fuzzing/old_crashes/gh221.json similarity index 100% rename from fuzzing/old_crashes/parse/gh221.json rename to fuzzing/old_crashes/gh221.json diff --git a/fuzzing/old_crashes/basic_parser/minimized-from-58a10325bce45df3e0b4988f932e5a400a344687 b/fuzzing/old_crashes/minimized-from-58a10325bce45df3e0b4988f932e5a400a344687 similarity index 100% rename from fuzzing/old_crashes/basic_parser/minimized-from-58a10325bce45df3e0b4988f932e5a400a344687 rename to fuzzing/old_crashes/minimized-from-58a10325bce45df3e0b4988f932e5a400a344687 diff --git a/fuzzing/old_crashes/direct_parse/tuple.json b/fuzzing/old_crashes/tuple.json similarity index 100% rename from fuzzing/old_crashes/direct_parse/tuple.json rename to fuzzing/old_crashes/tuple.json diff --git a/fuzzing/old_crashes/direct_parse/valid_cxx14.json b/fuzzing/old_crashes/valid_cxx14.json similarity index 100% rename from fuzzing/old_crashes/direct_parse/valid_cxx14.json rename to fuzzing/old_crashes/valid_cxx14.json diff --git a/fuzzing/old_crashes/direct_parse/valid_cxx17.json b/fuzzing/old_crashes/valid_cxx17.json similarity index 100% rename from fuzzing/old_crashes/direct_parse/valid_cxx17.json rename to fuzzing/old_crashes/valid_cxx17.json