- /*
- * Find the actual [slid] address of the shared cache's UUID, and copy it in from userland.
- */
- int shared_cache_uuid_valid = 0;
- uint64_t shared_cache_base_address = 0;
- struct _dyld_cache_header shared_cache_header = {};
- uint64_t shared_cache_slide = 0;
-
- /*
- * Don't copy in the entire shared cache header; we only need the UUID. Calculate the
- * offset of that one field.
- */
- int sc_header_uuid_offset = (char *)&shared_cache_header.uuid - (char *)&shared_cache_header;
- vm_shared_region_t sr = vm_shared_region_get(task);
- if (sr != NULL) {
- if ((vm_shared_region_start_address(sr, &shared_cache_base_address) == KERN_SUCCESS) &&
- (copyin(shared_cache_base_address + sc_header_uuid_offset, (char *)&shared_cache_header.uuid,
- sizeof(shared_cache_header.uuid)) == 0)) {
- shared_cache_uuid_valid = 1;
- shared_cache_slide = sr->sr_slide;
- }
- // vm_shared_region_get() gave us a reference on the shared region.
- vm_shared_region_deallocate(sr);
- }
-