This is an archive of the discontinued LLVM Phabricator instance.

[lsan][Darwin] Unconditionally strip high bits from potential pointers
ClosedPublic

Authored by lgrey on Jun 21 2023, 2:36 PM.

Details

Summary

The method cache stashes a mask in the high bits under some circumstances:
https://github.com/apple-oss-distributions/objc4/blob/689525d556eb3dee1ffb700423bccf5ecc501dbf/runtime/objc-cache.mm#L589

I'm hitting this now on macOS 13.4 arm64, so we can no longer rely on OBJC_DATA_MASK to identify potential pointers that need to be transformed

Diff Detail

Event Timeline

lgrey created this revision.Jun 21 2023, 2:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 2:36 PM
lgrey requested review of this revision.Jun 21 2023, 2:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 2:36 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
yln added a comment.Jun 30 2023, 9:11 AM

Hi Leonard, thanks for this fix!

LGTM, with one nit: can you update the function name and comments to reflect the new behavior?

compiler-rt/lib/lsan/lsan_common.cpp
173–178
lgrey updated this revision to Diff 537469.Jul 5 2023, 12:58 PM

Update function name and comment

lgrey marked an inline comment as done.Jul 5 2023, 12:59 PM
lgrey added inline comments.
compiler-rt/lib/lsan/lsan_common.cpp
173–178

Done (but worded differently since it's not just class pointers)

yln accepted this revision.Jul 12 2023, 7:11 PM
yln added reviewers: usaari01, rsundahl, thetruestblue.
This revision is now accepted and ready to land.Jul 12 2023, 7:11 PM
This revision was landed with ongoing or failed builds.Jul 17 2023, 12:19 PM
This revision was automatically updated to reflect the committed changes.
lgrey marked an inline comment as done.