This is an archive of the discontinued LLVM Phabricator instance.

[Clang][Driver] Add Bounds and Thread to SupportsCoverage list
ClosedPublic

Authored by melver on May 8 2020, 6:38 AM.

Details

Summary

This permits combining -fsanitize-coverage with -fsanitize=bounds or
-fsanitize=thread. Note that, GCC already supports combining these.

Tested:

  • Add Clang end-to-end test checking IR is generated for both combinations

of sanitizers.

  • Several previously failing TSAN tests now pass.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=45831

Diff Detail

Event Timeline

melver created this revision.May 8 2020, 6:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2020, 6:38 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

can you please add some basic IR test?

melver added a subscriber: dvyukov.May 12 2020, 5:05 AM
melver updated this revision to Diff 264109.May 14 2020, 3:00 PM

Add tests checking that when passing the combination of the sanitizer flags to Clang, we generate instrumentation for all enabled sanitizers.

melver edited the summary of this revision. (Show Details)May 14 2020, 3:01 PM
melver updated this revision to Diff 264112.May 14 2020, 3:08 PM

Fix formatting.

PTAL.

melver updated this revision to Diff 266048.May 25 2020, 10:41 AM

Address failing tests:

  • Set -triple for test.
  • Some existing tests now pass under TSAN, and can be enabled.
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2020, 10:41 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
melver updated this revision to Diff 266054.May 25 2020, 11:13 AM

-triple -> -target

melver updated this revision to Diff 266057.May 25 2020, 11:16 AM

Add missing -target to sanitize-coverage-bounds test.

melver edited the summary of this revision. (Show Details)May 26 2020, 9:02 AM

simplify some tests

vitalybuka accepted this revision.May 26 2020, 1:34 PM
This revision is now accepted and ready to land.May 26 2020, 1:34 PM
This revision was automatically updated to reflect the committed changes.

Hi Marco,

the Clang sanitize-coverage.c test gets crashed on Windows platform for armv7 target:

  • FAIL: Clang::sanitize-coverage.c
# command stderr:
Pass 'Run-time bounds checking' is not initialized.

Verify if there is a pass dependency cycle.

Required Passes:

	Target Library Information
...

see more details here: http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/7561/steps/test-check-clang/logs/FAIL%3A%20Clang%3A%3Asanitize-coverage.c

The first failed build: http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/7561

Would you take care of it?

melver added a comment.EditedMay 27 2020, 2:37 PM

the Clang sanitize-coverage.c test gets crashed on Windows platform for armv7 target:

  • FAIL: Clang::sanitize-coverage.c
# command stderr:
Pass 'Run-time bounds checking' is not initialized.

Verify if there is a pass dependency cycle.

Required Passes:

	Target Library Information
...

see more details here: http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/7561/steps/test-check-clang/logs/FAIL%3A%20Clang%3A%3Asanitize-coverage.c

The first failed build: http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/7561

Would you take care of it?

Thanks, I've been trying to understand this (similar failures on other armv7 instances). What's different with LLVM on armv7? Does it use a differently configured pass manager? Given this only fails on armv7, to me this highlights an issue with the architecture.

What I can do is blacklist the test for armv7 and thumbv7 until those architectures get fixed.

clang/test/CodeGen/sanitize-coverage.c is also failing our downstream embedded ARMv7 validations.

clang/test/CodeGen/sanitize-coverage.c is also failing our downstream embedded ARMv7 validations.

https://reviews.llvm.org/D80668 has been submitted. It would be good if someone with access to armv7 machines could verify if that works for now, since I can't test it.