This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Remove sanity checks during annotation of contiguous container
ClosedPublic

Authored by AdvenamTacet on Mar 7 2023, 2:21 AM.

Details

Summary

This revision removes sanity checks in
__sanitizer_annotate_contiguous_container.
(Changed them to DCHECK_EQ.)
Those checks may be problematic, if someone manually unpoisoned memory block.
Manual unpoisoning may be used if part of the program is not
instrumented.

Those checks are helpful while confirming correctness of ASan annotations
implementation.

Originally suggested here: https://reviews.llvm.org/D136765#4174546

Diff Detail

Event Timeline

AdvenamTacet created this revision.Mar 7 2023, 2:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2023, 2:21 AM
Herald added a subscriber: Enna1. · View Herald Transcript
AdvenamTacet requested review of this revision.Mar 7 2023, 2:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2023, 2:21 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Mar 7 2023, 6:46 PM
vitalybuka added inline comments.
compiler-rt/lib/asan/asan_poisoning.cpp
454

DCHECK?

This revision is now accepted and ready to land.Mar 7 2023, 6:46 PM
vitalybuka added inline comments.Mar 7 2023, 6:48 PM
compiler-rt/lib/asan/asan_poisoning.cpp
454

DCHECK?

Another option could be full repainting of the container.

AdvenamTacet retitled this revision from Remove sanity checks during annotation of contiguous container to [ASan] Remove sanity checks during annotation of contiguous container.Mar 10 2023, 3:30 AM

Changed to DCHECK.

AdvenamTacet marked an inline comment as done.Mar 10 2023, 3:33 AM
AdvenamTacet added inline comments.Mar 10 2023, 3:44 AM
compiler-rt/lib/asan/asan_poisoning.cpp
454

DCHECK is for sure good when writing annotations for libc++ containers. Repainting (if that check fails) may be a nice option as well, but I don't have a strong opinion.

AdvenamTacet edited the summary of this revision. (Show Details)Mar 20 2023, 11:08 AM

@vitalybuka could you land that revision as I don't have commiter rights?

AdvenamTacet marked an inline comment as done.May 3 2023, 8:25 PM
AdvenamTacet added inline comments.
compiler-rt/lib/asan/asan_poisoning.cpp
454

Repainting may have terrible performance in some cases, so it would require some way to turn it off. After looking at it closer, I don't really like it Yes, in 95% of cases it's ok solution, but if someone was able to unpoison memory area, should be able to poison as well. Let's not force it.

AdvenamTacet edited the summary of this revision. (Show Details)Jun 26 2023, 6:59 PM
AdvenamTacet edited the summary of this revision. (Show Details)

Rebase.