This is an archive of the discontinued LLVM Phabricator instance.

Add section headers to SpecialCaseLists
ClosedPublic

Authored by vlad.tsyrklevich on Sep 15 2017, 1:05 PM.

Details

Summary

Sanitizer blacklist entries currently apply to all sanitizers--there
is no way to specify that an entry should only apply to a specific
sanitizer. This is important for Control Flow Integrity since there are
several different CFI modes that can be enabled at once. For maximum
security, CFI blacklist entries should be scoped to only the specific
CFI mode(s) that entry applies to.

Adding section headers to SpecialCaseLists allows users to specify more
information about list entries, like sanitizer names or other metadata,
like so:

[section1]
fun:*fun1*
[section2|section3]
fun:*fun23*

The section headers are regular expressions. For backwards compatbility,
blacklist entries entered before a section header are put into the '[*]'
section so that blacklists without sections retain the same behavior.

SpecialCaseList has been modified to also accept a section name when
matching against the blacklist. It has also been modified so the
follow-up change to clang can define a derived class that allows
matching sections by SectionMask instead of by string.

Diff Detail

Repository
rL LLVM

Event Timeline

vlad.tsyrklevich edited the summary of this revision. (Show Details)Sep 15 2017, 1:23 PM
vlad.tsyrklevich added reviewers: pcc, kcc, eugenis, vsk.
vlad.tsyrklevich added a subscriber: llvm-commits.

maybe "git clang-format --style file -f HEAD~1"?

Run clang-format.

eugenis added inline comments.Sep 15 2017, 4:48 PM
lib/Support/SpecialCaseList.cpp
188 ↗(On Diff #115508)

typo: expressionf

eugenis added inline comments.Sep 18 2017, 2:45 PM
include/llvm/Support/SpecialCaseList.h
44 ↗(On Diff #115687)

where did this comment go?

lib/Support/SpecialCaseList.cpp
208 ↗(On Diff #115687)

Is not that a memory leak? Who deallocates SectionEntries?

include/llvm/Support/SpecialCaseList.h
44 ↗(On Diff #115687)

I deleted it because that link (1) has badly broken formatting that's not easy to understand and (2) seems to be long out-of-data anyways. fun_r and fun_hist don't seem to be supported by the current incarnation of TSan.

lib/Support/SpecialCaseList.cpp
208 ↗(On Diff #115687)

I thought I was correctly handling this but I'm not sure why on re-inspection. Fix incoming.

Refactor SectionsMap to map section names to indices into Sections and get rid of a memory leak by doing so

Update for SectionsMap refactor in LLVM

vlad.tsyrklevich marked 2 inline comments as done.Sep 18 2017, 4:45 PM
eugenis added inline comments.Sep 18 2017, 5:31 PM
include/llvm/Support/SpecialCaseList.h
137 ↗(On Diff #115750)

Does this need to be virtual?

Refactor to make compile() not virtual again

vlad.tsyrklevich marked an inline comment as done.Sep 19 2017, 9:01 AM
eugenis accepted this revision.Sep 20 2017, 6:05 PM
This revision is now accepted and ready to land.Sep 20 2017, 6:05 PM
vsk accepted this revision.Sep 20 2017, 6:06 PM

Thanks

This revision was automatically updated to reflect the committed changes.