summaryrefslogtreecommitdiff
path: root/view/sharedcache/core
AgeCommit message (Collapse)Author
2026-05-27Pull lambdas out into separate functions.Alexander Taylor
Addresses feedback from PR #8188.
2026-05-27Better handling for shared cache files in projects.Alexander Taylor
Closes #6630.
2026-05-27Improve UX when loading shared cache.Alexander Taylor
Closes #8020 and #8021.
2026-05-22Refactor calling conventions to support correct representation of structuresRusty Wagner
2026-04-22Always show the triage view when opening a shared cache or kernel cacheMark Rowe
BinaryViewType gains a HasNoInitialContent function that views can use to suppress layout restoration when opening a file. The layout will still be restored when the view is loaded from a saved database. Fixes https://github.com/Vector35/binaryninja-api/issues/8083.
2026-03-31Prevent a crash whenever readLEB128 is passed a nullptr0cyn
2026-03-30[DSC] Process Objective-C metadata when loading view from .bndbMark Rowe
The processed Objective-C metadata is not saved to the .bdnb. It must be recomputed when the view is loaded. Fixes https://github.com/Vector35/binaryninja-api/issues/8030.
2026-02-24[DSC] Simplify file mapping to fix intermittent unrelocated pointersMark Rowe
The `FileAccessorCache`'s LRU eviction could discard a file's mapped data after slide info had already been applied to it. Future accesses to the file produced a fresh mapping, but failed to reapply the slide info. This could result in pointers not correctly being slid, such as in https://github.com/Vector35/binaryninja-api/issues/7689. The LRU cache existed to stay within OS file descriptor limits, since the old `MappedFile` held its fd open for the lifetime of the mapping. There's no real reason for it to hold the file descriptor open like this. Closing it after `mmap` is sufficient to avoid the file descriptor limits. `MappedFileRegion` replaces the combination of `FileAccessorCache`, `WeakFileAccessor`, and `MappedFileAccessor`. It closes the fd immediately after mmap, so all files can stay mapped without consuming descriptors, making the cache unnecessary. `MappedFileRegion` is owned directly by the `CacheEntry` for its full lifetime. Slide info is applied exactly once to each `MappedFileRegion`.
2026-02-13[DSC] Correctly mark symbols as having local, global, or weak bindingMark Rowe
2025-12-20Fix many of the warnings that show up when compiling with GCC 15.2Mark Rowe
2025-12-08[DSC] Wrap section creation within BeginBulkAddSegments / EndBulkAddSegmentsMark Rowe
This defers rebuilding of the section map until after all sections for an image have been added, rather than having the section map be rebuilt after adding each section.
2025-12-08Introduce an RAII type for managing bulk symbol modificationsMark Rowe
Fixes https://github.com/Vector35/binaryninja-api/issues/7666. Correctly managing the state of bulk symbol modifications via `BeginBulkModifySymbols` / `EndBulkModifySymbols` is error-prone in the face of exceptions and early returns. Leaking a bulk symbol modification can leave the view in a state where no further changes to symbols will be applied. All users of the C++ API are encouraged to move from `BeginBulkModifySymbols` / `EndBulkModifySymbols` to the new `BulkSymbolModification` class.
2025-12-04[DSC] Fix unhandled exception when opening secondary cache file with ↵Mason Reed
unbacked regions Fixes https://github.com/Vector35/binaryninja-api/issues/7724
2025-11-26[DSC] Place synthetic sections after the cache's address rangeMark Rowe
This ensures they do not overlap with any images that may later be loaded from the shared cache.
2025-10-14Fix issue #7247WeiN76LQh
See https://github.com/Vector35/binaryninja-api/issues/7247#issuecomment-3392192797 for details.
2025-09-17[DSC] Ignore .a2s files when loading a shared cacheMark Rowe
These files are present alongside iOS 26 shared caches. Explicitly ignoring them avoids an error being logged to the console.
2025-09-17[DSC] Rework handling of .symbols files to be compatible with iOS 15Mark Rowe
In some iOS 15 caches, the .symbols file's mapping has an address of 0. This would cause it to be returned by `SharedCache::GetEntryContaining` and loaded into the view. The .symbols file contains the local symbol tables for images in the shared cache. It is not intended to be mapped into the same address space as the rest of the shared cache. `SharedCache` now tracks the symbols cache entry separately from other entries. A dedicated `VirtualMemory` region is used when accessing the data it contains. This could be a `FileAccessor`, but that would require additional changes within `SharedCacheMachOHeader`. `SharedCacheMachOProcessor` now directly accesses the local symbols cache entry rather than needing to search for it.
2025-09-17[DSC] Support relative direct selectors in older shared cache versionsMark Rowe
Prior to macOS 13 / iOS 16, the base offset to use for relative direct selector references within Objective-C message lists was stored within the `__TEXT,__objc_opt_ro` section of /usr/lib/libobjc.A.dylib.
2025-08-13[DSC] Add support for DriverKit shared cachesMark Rowe
2025-08-01Add LogForException APIs to pass stack trace information separate from the ↵Rusty Wagner
message
2025-07-30[CMake] Specify CONFIGURE_DEPENDS for all file(GLOB ..)Mark Rowe
This ensures that CMake detects when files that match the glob are added or removed.
2025-07-28SharedCache: Fix a compile error w/ GCCkat
2025-07-28Improve and migrate to fmt logging functions in Mach-O/KernelCache/SharedCachekat
2025-07-10[DSC] Use BNAllocStringWithLength when copying strings for the APIMark Rowe
We're copying `std::string` objects that know their length. There's no reason to force a call to `strlen`.
2025-07-10[DSC] Fix GetRegionAt / optimize GetRegionContainingMark Rowe
`GetRegionAt` was really providing the semantics of `GetRegionContaining` due to `m_regions` being an `AddressRangeMap` and using transparent comparators to allow `find` to work with any address in the range. `GetRegionAt` is updated to verify that the start address of the region that was found matches the requested address. `GetRegionContaining` is updated to use `AddressRangeMap::find` rather than doing a linear search over all regions.
2025-07-08Parse sections containing Objective-C constantsMark Rowe
This adds support for the `__objc_arrayobj`, `_objc_dictobj`, `__objc_intobj`, `__objc_floatobj`, `__objc_doubleobj` and `__objc_dateobj` sections that contain Objective-C constants. These are emitted by Apple's versions of Clang for `const` literals, amongst other things.
2025-07-07[ObjC] Fix handling of relative method selectors with MSVCMark Rowe
The order that the operands to `+` are evaluated in is unspecified. Clang happens to evaluate them left to right and gives the expected answer. MSVC picks the opposite order and so the value it computes is off by 4. This was resulting in missing method names when arm64 binaries containing Objective-C are analyzed on Windows.
2025-06-25Fix cxx20 build issue on Linux.Alexander Taylor
Apparently the compiler on macOS is less strict about this change?
2025-06-25Fix cxx20 compiler errors.Alexander Taylor
2025-06-25Update CXX_STANDARD to 20.Alexander Taylor
Also update minimum CMake version.
2025-06-06Objective-C Processor: Remove vestigial code tracking whether view was ↵kat
backed by a database
2025-05-30Misc shared cache improvementsMason Reed
- Removed last use of user object creation in objective-c - Fixed function type info being omitted from certain images loaded automatically - Add TODO about undo action in view init. This is not critical, just a non-actionable warning because of a design flaw I will restate this again for anyone in the future, until the undo action system is thread-safe avoid calling it from any thread other than the main thread, it is very easy to deadlock or cause other issues. That goes for basically all user analysis object creation.
2025-05-21[SharedCache] Fix .dylddata sections failing to propagate constantsMason Reed
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.
2025-05-13Rework Export Trie parser to avoid recursion, improve error checkingkat
2025-05-06[SharedCache] Add activities to core.function.metaAnalysis rather than a new ↵Mark Rowe
named workflow Activities are registered with a `viewType` predicate to ensure they only run in shared cache views. Adding activities to `core.function.metaAnalysis` lets activities registered by plug-ins run in the shared cache without the plug-ins having to be aware of the shared cache. Work towards #6779.
2025-05-03[SharedCache] Avoid reading header fields outside of the bounds of the headerDaniel Roethlisberger
Use mappingOffset as an upper bound for the header size, and avoid reading any header fields from beyond that offset. Co-authored-by: Mason Reed <mason@vector35.com>
2025-05-02[SharedCache] Have VirtualMemoryReader get the address size from the ↵Mark Rowe
underlying VirtualMemory
2025-05-02[SharedCache] Fix parsing of Objective-C metadataMark Rowe
8267ab475cb2ac82fd3724c009f21e8e30143f6b introduced a logic error in VirtualMemoryReader::ReadPointer that caused VirtualMemoryReader to attempt to read pointers from the wrong address, breaking parsing of Objective-C metadata.
2025-04-28[SharedCache] Support loading iOS shared caches older than 11Mason Reed
Still need to fix branch island images not being picked up
2025-04-28[SharedCache] Improve support for older shared cache versionsMason Reed
Fixed branch island regions being skipped
2025-04-28Misc shared cache performance improvementsMason Reed
2025-04-26[SharedCache] Update the ref count warning to only show when above 2Mason Reed
We will have 2 live references in the DeleteController function, this warning does not need to be shown.
2025-04-16Fix various views not being marked executableGlenn Smith
2025-04-14[SharedCache] Fix crash with cache entries with alignment bytes at the end ↵Mason Reed
of the header We did not truncate the buffer length when reading the header using the mappingOffset size, resulting in a buffer overflow.
2025-04-14[SharedCache] Evict file accessors from the global file accessor cache on ↵Mason Reed
file metadata destruction Previously we would just let them continue to exist after view destruction, this is fine assuming we expect the user to be re-opening the same cache over and over, but if a user wants to load a bunch of different caches they might want to evict the old file accessors so that COW pages are known to be evicted, along with other paged in memory.
2025-04-14[SharedCache] Fix overzealous alert about missing shared cache entriesMason Reed
Following the conversation in https://github.com/Vector35/binaryninja-api/issues/6631 we are going to make the edited alerts warnings and then also fix the warning showing on certain shared caches even when all entries are present.
2025-04-14[SharedCache] Allow project databases to be stored in a separate folderMason Reed
However the primary file will need to be selected each time you open, for that to be resolved we need to use project file UUID's or the cache entry UUID's themselves to traverse all project files
2025-04-14[SharedCache] Improve the gathering of cache entries in view initMason Reed
This commit addresses some of the issues regarding the retrieval of cache entries during view init, we now will try and store information in the database about the given shared cache entries so that we can better alert the user to possible issues during the loading of saved shared cache databases. We also simplified the logic so that the flow for retrieving the primary file cache is easier and users should be prompted when necessary to select the primary cache file if we cannot. More errors will also be shown to provide the users with more information about the shared cache and what issues they might have. For example we will now try and warn the users when they are opening a shared cache with less entries than what the shared cache reports having. We will also warn the users when opening a database if a previous secondary cache file is no longer available. In the future we can also utilize the shared cache UUID's for individual files to do a more aggressive search across directories in a project. This will make the file name lookup stuff potentially unnecessary, at least when opening a database with all file UUID's stored.
2025-04-14[SharedCache] Skip processing .atlas filesMason Reed
The atlas files include section name info on images, its not helpful for us and skipping it altogether will remove an unneeded error related to parsing this other format
2025-04-14[SharedCache] Misc cleanupMason Reed
- Make `SharedCache::m_entries` a simple std::vector we never lookup based off the entry ID - Remove some old comments - Rename some old variables so that they are accurate - Fix compiler warnings - Remove some unneeded copying