This is an archive of the discontinued LLVM Phabricator instance.

std::string asan annotations
Needs ReviewPublic

Authored by aizatsky on Sep 2 2015, 4:29 PM.

Details

Summary

This change adds ASAN container annotations to std::string. String-specific annotations can be disabled with _LIBCPP_NO_ASAN_STD_STRING define.

When the string is small, in-object memory is appropriately poisoned to catch the code accessing invalid memory regions.

For new string layout, it is impossible to poison memory precisely due to last byte containing string size. In this new layout last 8 bytes of string object are never poisoned.

Diff Detail

Event Timeline

aizatsky updated this revision to Diff 33880.Sep 2 2015, 4:29 PM
aizatsky retitled this revision from to simple methods work for short strings.
aizatsky updated this object.
aizatsky retitled this revision from simple methods work for short strings to std::string asan annotations.Sep 3 2015, 11:14 AM
aizatsky updated this object.
aizatsky updated this revision to Diff 38277.Oct 23 2015, 4:44 PM
This comment was removed by aizatsky.
aizatsky updated this revision to Diff 38278.Oct 23 2015, 4:51 PM
This comment was removed by aizatsky.
aizatsky updated this object.Nov 6 2015, 2:58 PM
aizatsky added reviewers: kcc, mclow.lists.
aizatsky added a subscriber: llvm-commits.
aizatsky updated this object.Nov 6 2015, 3:00 PM
kcc edited edge metadata.Nov 6 2015, 4:17 PM

looks reasonable. Please avoid space-only and {}-only changes.

Hopefully Marshall can have a look too.

include/string
1782

this division deserves a comment

2358

looks like you are only adding {}
do you need to?

2472

{}-only change?

2702

{}-only change?

2959

extra line?

2968

extra line?

3062

seems to be a common pattern. Hide it inside __annotate_*?

aizatsky updated this revision to Diff 39610.Nov 6 2015, 4:42 PM
aizatsky marked 6 inline comments as done.
aizatsky edited edge metadata.

nits

ptal

include/string
3062

It is not. Sometimes it is >, sometimes it is <, sometimes it is unconditionable.

friendly ping.

Marshall,

Is there still an interest in this? If there is, let's figure out a way to move this forward.

mclow.lists edited edge metadata.Jul 20 2016, 4:31 PM

I will rebase this as soon as D21459 lands.

Marshall,

I'm happy to rebase it myself if you have some time for reviewing this afterwards. I'd like to verify that everything works since it has been quite a while since I last touched this.

Mike - I'll be happy to review it after 5-Aug. (I'll be doing committee stuff all next week).

Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 2:30 AM