This is an archive of the discontinued LLVM Phabricator instance.

[SanitizerBinaryMetadata] Introduce SanitizerBinaryMetadata instrumentation pass
ClosedPublic

Authored by melver on Aug 1 2022, 2:00 AM.

Details

Summary

Introduces the SanitizerBinaryMetadata instrumentation pass which uses
the new MD_pcsections metadata kinds to instrument certain types of
instructions and functions required for breakpoint-based sanitizers.

The first intended user of the binary metadata emitted will be a variant
of GWP-TSan [1]. GWP-TSan will require information about atomic
accesses; to unambiguously determine if an access is atomic or not, we
also require "covered" information which code has been compiled with
SanitizerBinaryMetadata instrumentation enabled.

[1] https://llvm.org/devmtg/2020-09/slides/Morehouse-GWP-Tsan.pdf

Depends on D130879

Diff Detail

Event Timeline

melver created this revision.Aug 1 2022, 2:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 2:00 AM
melver requested review of this revision.Aug 1 2022, 2:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 2:00 AM
MTC added a subscriber: MTC.Aug 1 2022, 2:06 AM
Enna1 added a comment.Aug 1 2022, 2:15 AM

Hi, I'm interested about GWP-TSan. Is there any plan about open source GWP-TSan? :)

melver added a comment.Aug 1 2022, 4:41 AM

Hi, I'm interested about GWP-TSan. Is there any plan about open source GWP-TSan? :)

Thanks for the interest - yes definitely, but we're only at the beginning and have no stable version yet. The compiler support is a strong dependency and pre-requisite for us to get to a stable version.

Also see https://reviews.llvm.org/D130888 and the RFC: https://discourse.llvm.org/t/rfc-pc-keyed-metadata-at-runtime/64191

melver updated this revision to Diff 449218.Aug 2 2022, 1:30 AM

Add IR test.

dvyukov accepted this revision.Aug 2 2022, 1:33 AM
This revision is now accepted and ready to land.Aug 2 2022, 1:33 AM
melver updated this revision to Diff 449221.Aug 2 2022, 1:39 AM

Comment wording.

melver updated this revision to Diff 450300.Aug 5 2022, 8:18 AM
  • Change MDNode format to take aux constants as another MDNode.
  • Change createPCSections interface.