This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] When setting up shadow memory on iOS, fix handling the return value of task_info on older OS versions
ClosedPublic

Authored by kubamracek on Aug 3 2018, 3:12 PM.

Details

Summary

task_vm_info is a "revisioned" structure, new OS versions add fields to the end, and compatibility is based on the reported size. On older OS versions, min_address/max_address is not filled back. Let's handle that case. Unfortunately, we can't really write a test (as the failure only happens when on a specific OS version).

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek created this revision.Aug 3 2018, 3:12 PM
Herald added a subscriber: Restricted Project. · View Herald TranscriptAug 3 2018, 3:12 PM
delcypher requested changes to this revision.Aug 6 2018, 6:26 AM
delcypher added inline comments.
lib/sanitizer_common/sanitizer_mac.cc
893 ↗(On Diff #159102)

It looks like you're relying on task_vm_info being initialised to zero because presumably on older platforms task_info(...) will use a different task_vm_info layout that probably has less fields.
Given that task_info doesn't take the size of task_vm_info there's no way it could to set the other fields.

It looks like that's what = {}; does but it wasn't immediately obvious to me that this was calling a synthesised constructor that initialized everything to zero. Could you add a comment about zero initialization?

Other than that LGTM.

This revision now requires changes to proceed.Aug 6 2018, 6:26 AM
This revision was not accepted when it landed; it landed in state Needs Revision.Aug 17 2018, 10:54 AM
This revision was automatically updated to reflect the committed changes.