@@ -229,17 +229,47 @@ if [ "$SANITIZER" = "introspector" ] || [ "$RUST_SANITIZER" = "introspector" ];
229
229
230
230
# Install Fuzz-Introspector
231
231
pushd /fuzz-introspector/src
232
- python3 -m pip install .
232
+ python3 -m pip install -e .
233
233
popd
234
234
235
235
if [ " $FUZZING_LANGUAGE " = " python" ]; then
236
236
python3 /fuzz-introspector/src/main.py light --language=python
237
+ cp -rf $SRC /inspector/ /tmp/inspector-saved
237
238
elif [ " $FUZZING_LANGUAGE " = " jvm" ]; then
238
239
python3 /fuzz-introspector/src/main.py light --language=jvm
240
+ cp -rf $SRC /inspector/ /tmp/inspector-saved
239
241
elif [ " $FUZZING_LANGUAGE " = " rust" ]; then
240
242
python3 /fuzz-introspector/src/main.py light --language=rust
243
+ cp -rf $SRC /inspector/ /tmp/inspector-saved
241
244
else
242
245
python3 /fuzz-introspector/src/main.py light
246
+
247
+ # Make a copy of the light. This is needed because we run two versions of
248
+ # introspector: one based on pure statis analysis and one based on
249
+ # regular LTO.
250
+ cp -rf $SRC /inspector/ /tmp/inspector-saved
251
+
252
+
253
+ # Move coverage report.
254
+ if [ -d " $OUT /textcov_reports" ]
255
+ then
256
+ find $OUT /textcov_reports/ -name " *.covreport" -exec cp {} $SRC /inspector/ \;
257
+ find $OUT /textcov_reports/ -name " *.json" -exec cp {} $SRC /inspector/ \;
258
+ fi
259
+
260
+ # Make fuzz-introspector HTML report using light approach.
261
+ REPORT_ARGS=" --name=$PROJECT_NAME "
262
+
263
+ # Only pass coverage_url when COVERAGE_URL is set (in cloud builds)
264
+ if [[ ! -z " ${COVERAGE_URL+x} " ]]; then
265
+ REPORT_ARGS=" $REPORT_ARGS --coverage-url=${COVERAGE_URL} "
266
+ fi
267
+
268
+ # Run pure static analysis fuzz introspector
269
+ fuzz-introspector full --target-dir=$SRC \
270
+ --language=${FUZZING_LANGUAGE} \
271
+ --out-dir=$SRC /inspector \
272
+ ${REPORT_ARGS}
243
273
fi
244
274
245
275
rsync -avu --delete " $SRC /inspector/" " $OUT /inspector"
@@ -313,28 +343,37 @@ if [ "$SANITIZER" = "introspector" ] || [ "$RUST_SANITIZER" = "introspector" ];
313
343
unset CFLAGS
314
344
export G_ANALYTICS_TAG=" G-8WTFM1Y62J"
315
345
346
+ # If we get to here, it means the e.g. LTO had no problems and succeeded.
347
+ # TO this end, we wlil restore the original light analysis and used the
348
+ # LTO processing itself.
349
+ rm -rf $SRC /inspector
350
+ cp -rf /tmp/inspector-saved $SRC /inspector
351
+
352
+ cd /fuzz-introspector/src
353
+ python3 -m pip install -e .
354
+ cd /src/
355
+
316
356
if [ " $FUZZING_LANGUAGE " = " jvm" ]; then
317
357
echo " GOING jvm route"
318
358
319
359
set -x
320
360
# Output will be put in /out/
321
- python3 /fuzz-introspector/frontends/java/oss-fuzz-main.py
361
+ python3 -m fuzz_introspector.frontends.oss_fuzz --language jvm --target-dir $SRC --entrypoint fuzzerTestOneInput
362
+
322
363
# Move files temporarily to fit workflow of other languages.
323
364
mkdir -p $SRC /my-fi-data
324
- find $OUT / -name * .data -exec mv {} $SRC /my-fi-data/ \;
325
- find $OUT / -name * .data.yaml -exec mv {} $SRC /my-fi-data/ \;
365
+ find . / -name * .data -exec mv {} $SRC /my-fi-data/ \;
366
+ find . / -name * .data.yaml -exec mv {} $SRC /my-fi-data/ \;
326
367
elif [ " $FUZZING_LANGUAGE " = " rust" ]; then
327
368
echo " GOING rust route"
328
369
329
370
# Run the rust frontend
330
- pushd /fuzz-introspector/frontends/rust/rust_function_analyser
331
- cargo run -- $SRC
371
+ python3 -m fuzz_introspector.frontends.oss_fuzz --language rust --target-dir $SRC
332
372
333
373
# Move files temporarily to fix workflow of other languages.
334
374
mkdir -p $SRC /my-fi-data
335
375
find ./ -name " *.data" -exec mv {} $SRC /my-fi-data/ \;
336
376
find ./ -name " *.data.yaml" -exec mv {} $SRC /my-fi-data/ \;
337
- popd
338
377
339
378
# Restore the sanitizer flag for rust
340
379
export SANITIZER=" introspector"
@@ -359,43 +398,43 @@ if [ "$SANITIZER" = "introspector" ] || [ "$RUST_SANITIZER" = "introspector" ];
359
398
REPORT_ARGS=" --name=$PROJECT_NAME "
360
399
# Only pass coverage_url when COVERAGE_URL is set (in cloud builds)
361
400
if [[ ! -z " ${COVERAGE_URL+x} " ]]; then
362
- REPORT_ARGS=" $REPORT_ARGS --coverage_url =${COVERAGE_URL} "
401
+ REPORT_ARGS=" $REPORT_ARGS --coverage-url =${COVERAGE_URL} "
363
402
fi
364
403
365
404
# Do different things depending on languages
366
405
if [ " $FUZZING_LANGUAGE " = " python" ]; then
367
406
echo " GOING python route"
368
407
set -x
369
- REPORT_ARGS=" $REPORT_ARGS --target_dir =$SRC /inspector"
408
+ REPORT_ARGS=" $REPORT_ARGS --target-dir =$SRC /inspector"
370
409
REPORT_ARGS=" $REPORT_ARGS --language=python"
371
- python3 / fuzz-introspector/src/main.py report $REPORT_ARGS
410
+ fuzz-introspector report $REPORT_ARGS
372
411
rsync -avu --delete " $SRC /inspector/" " $OUT /inspector"
373
412
elif [ " $FUZZING_LANGUAGE " = " jvm" ]; then
374
413
echo " GOING jvm route"
375
414
set -x
376
415
find $OUT / -name " jacoco.xml" -exec cp {} $SRC /inspector/ \;
377
- REPORT_ARGS=" $REPORT_ARGS --target_dir =$SRC /inspector"
416
+ REPORT_ARGS=" $REPORT_ARGS --target-dir =$SRC /inspector"
378
417
REPORT_ARGS=" $REPORT_ARGS --language=jvm"
379
- python3 / fuzz-introspector/src/main.py report $REPORT_ARGS
418
+ fuzz-introspector report $REPORT_ARGS
380
419
rsync -avu --delete " $SRC /inspector/" " $OUT /inspector"
381
420
elif [ " $FUZZING_LANGUAGE " = " rust" ]; then
382
421
echo " GOING rust route"
383
- REPORT_ARGS=" $REPORT_ARGS --target_dir =$SRC /inspector"
422
+ REPORT_ARGS=" $REPORT_ARGS --target-dir =$SRC /inspector"
384
423
REPORT_ARGS=" $REPORT_ARGS --language=rust"
385
- python3 / fuzz-introspector/src/main.py report $REPORT_ARGS
424
+ fuzz-introspector report $REPORT_ARGS
386
425
rsync -avu --delete " $SRC /inspector/" " $OUT /inspector"
387
426
else
388
427
# C/C++
389
-
428
+ mkdir -p $SRC /inspector
390
429
# Correlate fuzzer binaries to fuzz-introspector's raw data
391
- python3 / fuzz-introspector/src/main.py correlate --binaries_dir =$OUT /
430
+ fuzz-introspector correlate --binaries-dir =$OUT /
392
431
393
432
# Generate fuzz-introspector HTML report, this generates
394
433
# the file exe_to_fuzz_introspector_logs.yaml
395
- REPORT_ARGS=" $REPORT_ARGS --target_dir =$SRC /inspector"
434
+ REPORT_ARGS=" $REPORT_ARGS --target-dir =$SRC /inspector"
396
435
# Use the just-generated correlation file
397
- REPORT_ARGS=" $REPORT_ARGS --correlation_file =exe_to_fuzz_introspector_logs.yaml"
398
- python3 / fuzz-introspector/src/main.py report $REPORT_ARGS
436
+ REPORT_ARGS=" $REPORT_ARGS --correlation-file =exe_to_fuzz_introspector_logs.yaml"
437
+ fuzz-introspector report $REPORT_ARGS
399
438
400
439
rsync -avu --delete " $SRC /inspector/" " $OUT /inspector"
401
440
fi
0 commit comments