feat(apple): inspect dyld shared caches and resolve system paths
macOS 11 and later ship system libraries only inside the dyld shared cache. trace_dylib_resolution therefore left every /usr/lib and /System load undetermined, and REA had no way to see what a cache contains. inspect_dyld_shared_cache (CLI inspect-dyld-shared-cache) reads a cache file set selected by path, without an open target. Its pure TypeScript reader parses modern and legacy dyld_cache_header layouts and reports: - UUID, architecture, platform, OS version, Mac Catalyst alternate, cache type, shared region, max slide; - every VM mapping; - each subcache by file suffix, checked by UUID. A missing or mismatched subcache makes coverage partial; - the complete image list. For each requested install path it reads that image's load commands through the cache mappings with the existing Mach-O reader. trace_dylib_resolution accepts an optional shared_cache. Absolute candidates found in a cache that serves the process's CPU family resolve with the new outcome and status `shared-cache`. That status also takes precedence over later in-bundle fallbacks such as a back-deployed libswiftCore. The result names the cache UUID and OS version it used. verify:dyld-shared-cache checks every image in the host cache (3,649 on macOS 26.6), with dependencies and their re-export, weak, upward and delay-init attributes, against `dyld_info -all_dyld_cache -linked_dylibs`. It also checks CLI/MCP parity, and that each shared-cache edge in the fixture trace is a library dyld actually loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a0ec3e2016
commit
ade11fa02d
@@ -1,4 +1,8 @@
|
||||
import { applicationVersionComparisonResultSchema } from "../domain/javascript/javascriptApplicationVersionComparisonSchemas.js";
|
||||
import {
|
||||
dyldSharedCacheResultSchema,
|
||||
inspectDyldSharedCacheInputSchema,
|
||||
} from "../domain/dyldSharedCache.js";
|
||||
import { applicationFeatureTraceResultSchema } from "../domain/javascript/javascriptFeatureTraceSchemas.js";
|
||||
import { javaScriptSemanticTraceResultSchema } from "../domain/javascript/javascriptSemanticTraceSchemas.js";
|
||||
import { javaScriptExportShapeComparisonResultSchema } from "../domain/javascript/javascriptExportShapeComparisonSchemas.js";
|
||||
@@ -295,6 +299,25 @@ export const APPLICATION_TOOL_CONTRACTS = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "inspect_dyld_shared_cache",
|
||||
...toolContractMetadata("inspect_dyld_shared_cache"),
|
||||
description:
|
||||
"Inspect an Apple dyld shared cache file set selected by path, such as /System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld/dyld_shared_cache_arm64e or one extracted from an IPSW. Reports the cache UUID, architecture, platform and OS version, VM mappings, every subcache with UUID verification, and the complete image list. For each requested install path, it reads that image's load commands (install name, dependencies, rpaths) through the cache mappings. Pure file parsing: nothing is executed, slid, or extracted.",
|
||||
kind: "application",
|
||||
inputSchema: inspectDyldSharedCacheInputSchema,
|
||||
outputSchema: evidenceResultOf(dyldSharedCacheResultSchema),
|
||||
examples: [
|
||||
{
|
||||
title: "Inspect the host's arm64e shared cache and libSystem",
|
||||
input: {
|
||||
cache_path:
|
||||
"/System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld/dyld_shared_cache_arm64e",
|
||||
images: ["/usr/lib/libSystem.B.dylib"],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
] as const satisfies readonly ToolContract[];
|
||||
|
||||
/** Resolve one named application contract without relying on array position. */
|
||||
@@ -325,6 +348,9 @@ export function applicationToolContract(
|
||||
export function applicationToolContract(
|
||||
name: "project_apple_application_graph",
|
||||
): (typeof APPLICATION_TOOL_CONTRACTS)[8];
|
||||
export function applicationToolContract(
|
||||
name: "inspect_dyld_shared_cache",
|
||||
): (typeof APPLICATION_TOOL_CONTRACTS)[9];
|
||||
export function applicationToolContract(
|
||||
name: (typeof APPLICATION_TOOL_CONTRACTS)[number]["name"],
|
||||
): (typeof APPLICATION_TOOL_CONTRACTS)[number] {
|
||||
|
||||
@@ -248,6 +248,7 @@ export const TOOL_EFFECTS: Readonly<Record<string, ToolEffects>> = {
|
||||
evaluate_reconstruction_coverage: effects(),
|
||||
project_android_application_graph: evidence,
|
||||
project_apple_application_graph: evidence,
|
||||
inspect_dyld_shared_cache: evidence,
|
||||
open_binary: effects({ mutatesSession: true, launchesProcess: true }),
|
||||
close_binary: effects({
|
||||
mutatesSession: true,
|
||||
|
||||
Reference in New Issue
Block a user