From 49ea03c417168a707125169b77e6ff1c7ebbe097 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Wed, 2 Apr 2025 14:42:10 -0400 Subject: [SharedCache] Fix old slide info mapping format not getting the mapped address for the file offset This would result in the virtual memory trying to access an unmapped region, failing to apply slide info --- view/sharedcache/core/SlideInfo.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'view/sharedcache/core/SlideInfo.cpp') diff --git a/view/sharedcache/core/SlideInfo.cpp b/view/sharedcache/core/SlideInfo.cpp index e258a90c..3ab83d33 100644 --- a/view/sharedcache/core/SlideInfo.cpp +++ b/view/sharedcache/core/SlideInfo.cpp @@ -16,12 +16,6 @@ void ApplySlideInfoV5(VirtualMemory& vm, const SlideMappingInfo& mapping) uint64_t pageStartCount = mapping.slideInfoV5.page_starts_count; uint64_t pageSize = mapping.slideInfoV5.page_size; - uint64_t offset; - // Retrieve this once so we don't need to keep querying the region through the VM. - auto region = vm.GetRegionAtAddress(mapping.address, offset); - if (!region.has_value()) - throw UnmappedRegionException(mapping.address); - auto cursor = pageStartsOffset; for (size_t i = 0; i < pageStartCount; i++) { @@ -198,6 +192,10 @@ std::vector SlideInfoProcessor::ReadEntryInfo(VirtualMemory& v else if (singleMapping.slideInfoVersion == 3) vm.Read(&singleMapping.slideInfoV3, *slideInfoAddress, sizeof(dyld_cache_slide_info_v3)); + // Adjust the file offset to mapped, we are expecting the consumer to just take it in as mapped. + // if we did not make it mapped, then we would need to do all this weirdness in every consumer (each slide info version) + singleMapping.mappingInfo.fileOffset = *entry.GetMappedAddress(singleMapping.mappingInfo.fileOffset); + return {singleMapping}; } -- cgit v1.3.1