fix(apple): gate shared-cache answers on platform and verified subcaches

- Use a supplied cache for a process only when it serves the process's CPU
  family and one of its LC_BUILD_VERSION or LC_VERSION_MIN platforms matches
  the cache's platform or alternate platform; slices now report platforms.
  A limitation names each root the cache was not used for, and why.
- Treat an image listed in the cache but mapped in a missing or
  UUID-mismatched subcache as undetermined, list it in
  coverage.unverified_shared_cache_images, and mark coverage partial.
- Keep a cache hit conditional when an earlier candidate is undeterminable.
- Open a development cache's named subcaches beside its base name.
- Describe absolute paths as not evaluated only when no cache is supplied.
- Preflight dyld_info in verify:dyld-shared-cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 12:36:43 +00:00
co-authored by Claude Opus 5.5
parent 202661f83b
commit 305474df6c
20 changed files with 670 additions and 299 deletions
+23 -12
View File
@@ -154,13 +154,13 @@ parser coverage, such as big-endian images), `architecture-missing`,
`outside-target`, `shared-cache`, `escapes-target`, or `undetermined`. Slices follow dyld's
graded architectures, so an `x86_64h` process also loads `x86_64`. The edge's `resolution` is one of:
| Status | Meaning |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `resolved` | An image inside the analyzed root loads, and no earlier candidate was undeterminable. |
| `conditional` | An image inside the root resolves, but an earlier candidate outside the root (for example `/usr/lib/swift`) would win if it exists on the running system. |
| `unresolved` | Every candidate is definitively absent or unusable inside the root. |
| `undetermined` | No candidate resolves inside the root, and some candidate lies outside it or depends on the environment. |
| `shared-cache` | An absolute install path, or an `@rpath` candidate outside the root, was found in the dyld shared cache passed as `shared_cache` (CLI `--shared-cache`). dyld loads the cached image, so later in-root candidates are unused. |
| Status | Meaning |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `resolved` | An image inside the analyzed root loads, and no earlier candidate was undeterminable. |
| `conditional` | An image inside the root, or in the supplied shared cache, resolves, but an earlier candidate that REA cannot decide (for example `/opt/vendor/lib` or `/usr/lib/swift` without a cache) would win if it exists on the running system. |
| `unresolved` | Every candidate is definitively absent or unusable inside the root. |
| `undetermined` | No candidate resolves inside the root, and some candidate lies outside it or depends on the environment. |
| `shared-cache` | An absolute install path, or an `@rpath` candidate outside the root, was found in the dyld shared cache passed as `shared_cache` (CLI `--shared-cache`). dyld loads the cached image, so later in-root candidates are unused. |
Absolute install names such as `/usr/lib/libSystem.B.dylib` are
`outside-target`. On macOS 11 and later most of them live in the dyld shared
@@ -180,11 +180,22 @@ cache rather than on disk, so REA does not check them against the host.
image. It also compares the predicted load order of two process roots with the
images dyld actually loads (`DYLD_PRINT_LIBRARIES`).
With `shared_cache`, absolute candidates are looked up in that cache's image list.
This only happens when the cache serves the process's CPU family: an arm64e
cache serves arm64 and arm64e processes. The result's `shared_cache` names the
cache path, UUID, architecture and OS version. Cached images are not traversed.
Without a cache, system paths stay `undetermined`.
With `shared_cache`, absolute candidates are looked up in that cache's image
list. A process uses the cache only when both of these hold:
- the cache serves its CPU family (an arm64e cache serves arm64 and arm64e);
- one of its `LC_BUILD_VERSION` or `LC_VERSION_MIN_*` platforms (reported per
slice as `platforms`) matches the cache's platform or alternate platform.
An iOS cache extracted from an IPSW is therefore not used for a macOS
executable. A limitation names each process root the cache was not used for,
and why. The result's `shared_cache` names the cache path, UUID, architecture
and OS version. Cached images are not traversed.
An image listed in the cache but mapped in a missing or UUID-mismatched
subcache is `undetermined`. It is listed in
`coverage.unverified_shared_cache_images` and makes coverage partial. Without a
cache, system paths stay `undetermined`.
## dyld shared cache
+2 -2
View File
@@ -677,9 +677,9 @@
"mcp_prompts": 6
},
"digests": {
"tools_sha256": "be8eeb3bf69c3093848cc410221f9c5a79b7f94b9079d0fe5ca9085216383d8d",
"tools_sha256": "696d7cd44d8b2be6a8f03c11760de2bec5fc0cd5170d2dfe697076ab025ceea7",
"prompts_sha256": "ef2de8814390b340623c32001610aa2709d90bed51537b6e562ab3abf144ab4d",
"combined_sha256": "8d0b94ffbc1034a7fa9f3d42da1cd3cd0b758d09602b64f872d80dfd33b9e5cb",
"combined_sha256": "f8946c1a0c1084e431e313a8c2b3585ff0838bd8e6c0d33ac924d1cc00410e0a",
"providers_sha256": "14d933c5926c106e8cde60a37747e9758313fbfd651485ec96733bc608476255"
}
}
@@ -1,5 +1,5 @@
{
"manifest_id": "ecm_8e4ae241488b49878273e743203acbee2c1c695654d66ade1ce49dde25e8c3c6",
"manifest_id": "ecm_f3faddc5e13549c680547c8b551770be1525f2a5f2915be1c5e8a90647d208ad",
"verifier": {
"id": "rea-managed-conformance",
"version": "1"
@@ -13,7 +13,7 @@
"skill_digests": [
{
"skill_id": "reverse-engineer-anything",
"sha256": "d3a9bb7a561b5ce617dfa1d988e4567bb602364599b5763f287555c7cd997170"
"sha256": "cd79389c3dba83ac47ef9b819c4658626567aa049a150989d973e066c61a59c4"
}
],
"claims": [