Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly handle dyld caches on macOS 13 and above #642

Merged
merged 4 commits into from
Mar 11, 2024

Commits on Mar 9, 2024

  1. Correctly handle dyld caches on macOS 13 and above

    This allows successful parsing of dyld caches on
    macOS 13 and above on Intel Macs.
    
    The main dyld cache file on macOS contains an array of
    subcache info structs, each of which specifies the UUID
    (and some other information) of each subcache.
    `DyldCache::parse` checks that the subcache UUIDs match
    these expected UUIDs.
    
    In macOS 13, the format of the subcache info struct
    changed: it gained an additional field after the UUID
    field. This means that as soon as you had more than
    one subcache, our UUID check would fail, because the
    second subcache UUID would be read from the wrong offset.
    
    I didn't notice this on my Apple Silicon Mac, because
    the arm64e dyld cache only has one subcache:
    `dyld_shared_cache_arm64e.01`.
    But on Intel Macs, there are currently four subcaches:
    `dyld_shared_cache_x86_64.01`, `.02`, `.03`, and `.04`.
    
    In practice this means that my software hasn't been able to
    symbolicate macOS system libraries on Intel Macs since
    the release of macOS 13.
    
    This commit adds the new struct definition and makes
    the UUID check work correctly.
    
    This is a breaking change to the public API. I added
    a `DyldSubCacheSlice` enum, but I'm not particularly
    fond of it.
    I'm also not a big fan of the new allocation for the
    Vec of UUIDs, but it seemed better than the alternatives
    I tried, which all had a bunch of code duplication.
    mstange committed Mar 9, 2024
    Configuration menu
    Copy the full SHA
    1a1fab7 View commit details
    Browse the repository at this point in the history

Commits on Mar 10, 2024

  1. Make dyldcachedump and objdump load the correct dyld subcaches.

    dyldcachedump was working correctly on macOS 13+ because it was trying
    the "leading zero" suffix format as well as the "no leading zero" suffix
    format. This commit changes it to read the suffix from the main cache
    header.
    
    objdump was not able to parse dyld shared cache files on macOS 13+ because
    it was only using the "no leading zero" suffix format, and thus not finding
    the subcaches.
    mstange committed Mar 10, 2024
    Configuration menu
    Copy the full SHA
    a24f21c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6c15656 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    40ba225 View commit details
    Browse the repository at this point in the history