This is an archive of the discontinued LLVM Phabricator instance.

Add iOS/watchOS/tvOS support for ASan (llvm part)
ClosedPublic

Authored by zaks.anna on Dec 17 2015, 12:42 PM.

Details

Summary

Set the shadow region on iOS/watchOS/tvOS.

This change along with the corresponding changes in clang and compiler-rt completes ASan support for iOS/watchOS/tvOS.

Diff Detail

Repository
rL LLVM

Event Timeline

zaks.anna updated this revision to Diff 43172.Dec 17 2015, 12:42 PM
zaks.anna retitled this revision from to Add iOS/watchOS/tvOS support for ASan (llvm part).
zaks.anna updated this object.
zaks.anna added reviewers: llvm-commits, kcc.
samsonov added inline comments.Jan 22 2016, 2:14 PM
lib/Transforms/Instrumentation/AddressSanitizer.cpp
70 ↗(On Diff #43172)

Please group all IOS constants together.

365 ↗(On Diff #43172)

Looks like the order becomes important here. Maybe:

else if (IsIOS)
  Mapping.Offset = IsX86 ? kIOSSimShadowOffset32 : kIOSShadowOffset32;

here and below? And a comment describing the rationale behind this (I guess, it's just an heuristic, right?)

zaks.anna added inline comments.Jan 22 2016, 2:24 PM
lib/Transforms/Instrumentation/AddressSanitizer.cpp
365 ↗(On Diff #43172)

(I guess, it's just an heuristic, right?)

What do you mean? We are setting the location of the shadow on the device and the simulator (IsIOS and IsX86 -> simulator). The simulator has the host's VM layout. The device has a very different (and restricted) VM layout.

samsonov added inline comments.Jan 22 2016, 2:34 PM
lib/Transforms/Instrumentation/AddressSanitizer.cpp
365 ↗(On Diff #43172)

Right, I mean that if we're building for iOS and target x86, you "assume" you're building for ios simulator, but this assumption is not explicitly deducible from the code.

zaks.anna updated this revision to Diff 45754.Jan 22 2016, 2:45 PM

Address all Samsonov's review comments.

samsonov accepted this revision.Jan 22 2016, 2:48 PM
samsonov edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jan 22 2016, 2:48 PM
This revision was automatically updated to reflect the committed changes.