This is an archive of the discontinued LLVM Phabricator instance.

[libFuzzer] Set default sanitizer options in fuzzer tests
ClosedPublic

Authored by yln on Jan 30 2019, 10:13 AM.

Details

Summary

Set default ASAN_OPTIONS when running libFuzzer tests. This allows us
to remove special casing in code for Darwin where we usually pass
abort_on_error=0 to override platform defaults for tests.

A previous commit changed the code to make the tests pass:
https://github.com/llvm/llvm-project/commit/7764a04af007eca68eafcf5caaea560ed05e35a9

Adapted a few tests to use %env_asan_opts= instead of directly setting
the environment variable.

Event Timeline

yln created this revision.Jan 30 2019, 10:13 AM
yln set the repository for this revision to rCRT Compiler Runtime.
yln added a project: Restricted Project.
yln added a subscriber: llvm-commits.
Herald added a subscriber: Restricted Project. · View Herald TranscriptJan 30 2019, 10:24 AM
kcc edited reviewers, added: morehouse; removed: samsonov, glider.Jan 30 2019, 10:55 AM

The change makes sense to me: seems https://github.com/llvm/llvm-project/commit/7764a04af007eca68eafcf5caaea560ed05e35a9 was not correct and a proper fix was to use avoid crashing using ASAN_OPTIONS instead.

kcc added a comment.Jan 30 2019, 3:49 PM

note: dump_coverage.test is already gone.

kcc added a comment.Jan 30 2019, 4:10 PM

Also, r352700 adds another test (large.test) with ASAN_OPTIONS.
Please update the patch. Otherwise looks good.

yln updated this revision to Diff 184415.Jan 30 2019, 5:03 PM

Update patch.

kcc accepted this revision.Jan 30 2019, 5:05 PM

LGTM

This revision is now accepted and ready to land.Jan 30 2019, 5:05 PM
yln added a comment.Jan 30 2019, 5:06 PM

There is one more occurrence in afl-driver-stderr.test, but I think it is purposefully used to reset the options.

; Test that specifying an invalid file causes a crash.
RUN: ASAN_OPTIONS= AFL_DRIVER_STDERR_DUPLICATE_FILENAME="%T" not --crash %run %t-AFLDriverTest
This revision was automatically updated to reflect the committed changes.