This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizers] Cleanup handling of stat64/statfs64
ClosedPublic

Authored by wrotki on Jun 23 2022, 3:58 PM.

Details

Summary

This is a follow up to <LLVM reviews>/D127343, which was reverted due to test failures.

There are differences in handling of stat64/statfs64 calls by sanitizers between Linux and macOS. Versions of macOS starting with 10.6 drop the stat64/statfs64 APIs completely, relying on the linker to redirect stat/statfs to the appropriate 64 bit versions. Emitting variables needed by sanitizers is thus controlled by convoluted sets of conditions, involving Linux, IOS, macOS and Android, sprinkled around files.

This change clarifies it a bit, allowing to specify presence/absence of stat64/statfs64 for each platform, in a single location.

Please note that I wasn't able to test this change on platforms other than macOS and Linux Fedora 34. The previous attempt has caused test failures but couldn't figure out the context. I have a vague suspicion that they were Android and perhaps Fuchsia builds - and some build involving ppc64le, I don't have hardware handy to attempt a test there. Tried to tighten the conditions this time to clearly separate macOS from Linux, so Linux builds should behave same (sanitizerwise) as before the change. Will add people who reported the tests failing before as reviewers, so they can provide context should the change cause the test failures again.

Diff Detail

Event Timeline

wrotki created this revision.Jun 23 2022, 3:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 3:58 PM
Herald added a subscriber: Enna1. · View Herald Transcript
wrotki requested review of this revision.Jun 23 2022, 3:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 3:58 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
yln added a comment.Jun 23 2022, 4:34 PM

Thanks @wrotki!

@dyung @abrachet @hctim would you be able to help us test this before landing?

dyung added a comment.Jun 23 2022, 6:05 PM

I can confirm that the change seems to be working for me!

yln accepted this revision.Jun 28 2022, 11:05 AM

Thank you @dyung!

@wrotki: Let's try again *fingers crossed*

This revision is now accepted and ready to land.Jun 28 2022, 11:05 AM
This revision was landed with ongoing or failed builds.Jun 28 2022, 3:02 PM
This revision was automatically updated to reflect the committed changes.