This is an archive of the discontinued LLVM Phabricator instance.

[SanitizerCoverage] Add -fsanitize-coverage=inline-bool-flag
ClosedPublic

Authored by pratyai on Apr 7 2020, 4:23 AM.

Diff Detail

Event Timeline

pratyai created this revision.Apr 7 2020, 4:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2020, 4:23 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
pratyai updated this revision to Diff 255638.Apr 7 2020, 4:24 AM
vitalybuka accepted this revision.Apr 8 2020, 6:01 PM
vitalybuka added inline comments.
clang/test/Driver/fsanitize-coverage.c
114

this is preexisted block, could you make sure it's outside of your changes? move up or down
or it looks like you replaced these lines

This revision is now accepted and ready to land.Apr 8 2020, 6:01 PM
pratyai updated this revision to Diff 256178.Apr 8 2020, 9:10 PM
pratyai marked 2 inline comments as done.Apr 8 2020, 9:13 PM
pratyai added inline comments.
clang/test/Driver/fsanitize-coverage.c
114

Moved the block up.

There is a slight change in the name s/CHECK_PC_TABLE/CHECK_PC_TABLE_FOR_INLINE8BIT/ to make it a counterpart of CHECK_PC_TABLE_FOR_INLINEBOOL.

The change isn't strictly necessary. Let me know if it should be dropped.

vitalybuka retitled this revision from [part 2] sancov/inline-bool-flag clang flags. to [SanitizerCoverage] Add -fsanitize-coverage=inline-bool-flag.Apr 8 2020, 10:46 PM
vitalybuka edited the summary of this revision. (Show Details)

With this patch check-fuzzer does not work

********************
FAIL: libFuzzer :: value-profile-load.test (63806 of 66139)
******************** TEST 'libFuzzer :: value-profile-load.test' FAILED ********************
Script:
--
: 'RUN: at line 2';     /usr/local/google/home/vitalybuka/src/llvm.git/out/z/./bin/clang  --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/lib/fuzzer -m64 /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/test/fuzzer/LoadTest.cpp -fsanitize-coverage=trace-gep -o /usr/local/google/home/vitalybuka/src/llvm.git/out/z/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/value-profile-load.test.tmp-LoadTest
: 'RUN: at line 3';   not  /usr/local/google/home/vitalybuka/src/llvm.git/out/z/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/value-profile-load.test.tmp-LoadTest -seed=2 -use_cmp=0 -use_value_profile=1 -runs=20000000 2>&1 | FileCheck /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/test/fuzzer/value-profile-load.test
--
Exit Code: 1

Command Output (stderr):
--
/usr/bin/ld: /tmp/LoadTest-431748.o: in function `sancov.module_ctor_bool_flag':
LoadTest.cpp:(.text.sancov.module_ctor_bool_flag[sancov.module_ctor_bool_flag]+0x16): undefined reference to `__sanitizer_cov_bool_flag_init'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
pratyai updated this revision to Diff 256206.Apr 9 2020, 12:35 AM
pratyai marked an inline comment as done.
pratyai updated this revision to Diff 256211.Apr 9 2020, 1:23 AM

Was unintentionally enabling the bool-flag coverage in SanitizerArgs.cpp before (line#383, if (Add & SanitizerKind::FuzzerNoLink) { CoverageFeatures |= ... }

Couldn't catch it before because cmake -G Ninja ../llvm didn't generate check-fuzzer target for me. Is there any option to enable fuzzer target generation?

Was unintentionally enabling the bool-flag coverage in SanitizerArgs.cpp before (line#383, if (Add & SanitizerKind::FuzzerNoLink) { CoverageFeatures |= ... }

Couldn't catch it before because cmake -G Ninja ../llvm didn't generate check-fuzzer target for me. Is there any option to enable fuzzer target generation?

i have
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;lld" -DCOMPILER_RT_BUILD_LIBFUZZER=ON
try to check-all as well

This revision was automatically updated to reflect the committed changes.