diff options
| author | Mason Reed <mason@vector35.com> | 2025-05-21 17:22:32 +0200 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-05-21 17:22:32 +0200 |
| commit | 397b5693c4b354349ade15eab09baa5dde744f1c (patch) | |
| tree | 8444eefeb8c2d606e7dfea5255348e95e556198c | |
| parent | f441eb7762fc6aeba3334e3c9d41a6812ab3ad67 (diff) | |
[SharedCache] Fix .dylddata sections failing to propagate constants
This occurred because prior to the change made in build `7484` we short-circuited when the pointer pointed to a read only segment, now that we consult the section the sections semantics were incorrect and failed, this fixes the dyld data sections to have correct semantics.
| -rw-r--r-- | view/sharedcache/core/SharedCache.cpp | 2 | ||||
| -rw-r--r-- | view/sharedcache/workflow/SharedCacheWorkflow.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp index e4689086..0198ac48 100644 --- a/view/sharedcache/core/SharedCache.cpp +++ b/view/sharedcache/core/SharedCache.cpp @@ -368,7 +368,7 @@ void SharedCache::ProcessEntryRegions(const CacheEntry& entry) mappingRegion.start = mapping.address; mappingRegion.size = mapping.size; mappingRegion.name = fmt::format("{}::_data_{}", entry.GetFileName(), lastMappingIndex++); - mappingRegion.flags = SegmentReadable; + mappingRegion.flags = static_cast<BNSegmentFlag>(SegmentReadable | SegmentDenyWrite); mappingRegion.type = CacheRegionType::DyldData; // Add the dyld data mapping as a region to the cache. diff --git a/view/sharedcache/workflow/SharedCacheWorkflow.cpp b/view/sharedcache/workflow/SharedCacheWorkflow.cpp index 71160e44..cde8310c 100644 --- a/view/sharedcache/workflow/SharedCacheWorkflow.cpp +++ b/view/sharedcache/workflow/SharedCacheWorkflow.cpp @@ -128,7 +128,7 @@ void AnalyzeStubFunction(Ref<Function> func, Ref<MediumLevelILFunction> mlil, Sh // Adjust the new region semantics to read only, this helps analysis pickup constant loads in our stub functions. // NOTE: We do NOT do this for stub island as that contains CODE! if (region->type != SharedCacheRegionTypeStubIsland) - region->flags = static_cast<BNSegmentFlag>(SegmentReadable | SegmentContainsData); + region->flags = static_cast<BNSegmentFlag>(SegmentReadable | SegmentContainsData | SegmentDenyWrite); return controller.ApplyRegion(*view, *region); }; @@ -252,7 +252,7 @@ void AnalyzeStandardFunction(Ref<Function> func, Ref<MediumLevelILFunction> mlil // Adjust the new region semantics to read only, this helps analysis pickup constant loads in our stub functions. // NOTE: We do NOT do this for stub island as that contains CODE! if (region->type != SharedCacheRegionTypeStubIsland) - region->flags = static_cast<BNSegmentFlag>(SegmentReadable | SegmentContainsData); + region->flags = static_cast<BNSegmentFlag>(SegmentReadable | SegmentContainsData | SegmentDenyWrite); return controller.ApplyRegion(*view, *region); }; |
