fix(apple): preserve slice identity and macOS boundary diagnostics (#1772)
* fix(artifacts): name CPU_SUBTYPE_ARM64E_X1 Mach-O slices arm64e macOS 27 system binaries such as /bin/ls carry a third FAT slice with cpusubtype 0x8000000c. The SDK defines subtype 12 as CPU_SUBTYPE_ARM64E_X1, and CPU_SUBTYPE_HAS_ARM64E puts it in the arm64e family. architectureName knew only subtype 2, so it named the slice arm64, lipoNameMatches rejected lipo's arm64e.x1 name, and inspect-artifact /bin/ls failed with integrity_mismatch. The arm64e.x1 test fixture now uses the real subtype. It fails without this change. Refs #1168, #1765 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(artifacts): classify en-GB hdiutil verify refusals as format failures hdiutil follows AppleLanguages. With en-GB it writes "image not recognised", and verifyFailureReason matched only the US spelling, so a file that is not a disk image got the reason unavailable. Both spellings now give format. Other languages still give unavailable. Refs #1765 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(process): read the full process table in the lifecycle cleanup check The check ran ps -axo command= with the Node default maxBuffer of 1 MiB. On a host with 1905 processes, the output is 1.52 MB, and the test failed with "stdout maxBuffer length exceeded". Refs #1765 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(process): bound cleanup observations to sampled descendants * fix(apple): retain CPU subtype identity during dylib resolution * test(process): retain OS PIDs for descendant observations --------- Co-authored-by: David Lee <davidlee@Dav3Book-Pro-M4-Max.local> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
co-authored by
David Lee
Claude Opus 5.5
morluto
parent
85e124253a
commit
5c2956587a
@@ -3,6 +3,7 @@ import type {
|
||||
DylibTreeView,
|
||||
MachoSlice,
|
||||
} from "./dylibResolution.js";
|
||||
import { machoCpuSubtypeBase } from "./machoCpuIdentity.js";
|
||||
|
||||
const MAX_SYMLINK_HOPS = 32;
|
||||
|
||||
@@ -105,10 +106,19 @@ const COMPATIBLE_ARCHITECTURES: Readonly<Record<string, readonly string[]>> = {
|
||||
|
||||
export const compatibleSlice = (
|
||||
slices: readonly MachoSlice[],
|
||||
process: string,
|
||||
process: Pick<MachoSlice, "architecture" | "cpu_type" | "cpu_subtype">,
|
||||
): MachoSlice | undefined => {
|
||||
for (const architecture of COMPATIBLE_ARCHITECTURES[process] ?? [process]) {
|
||||
const slice = slices.find((item) => item.architecture === architecture);
|
||||
for (const architecture of COMPATIBLE_ARCHITECTURES[process.architecture] ?? [
|
||||
process.architecture,
|
||||
]) {
|
||||
const slice = slices.find(
|
||||
(item) =>
|
||||
item.architecture === architecture &&
|
||||
(process.architecture !== "arm64e" ||
|
||||
(item.cpu_type === process.cpu_type &&
|
||||
machoCpuSubtypeBase(item.cpu_subtype) ===
|
||||
machoCpuSubtypeBase(process.cpu_subtype))),
|
||||
);
|
||||
if (slice !== undefined) return slice;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
@@ -220,7 +220,10 @@ interface LoadedImage {
|
||||
interface ProcessContext {
|
||||
readonly view: DylibTreeView;
|
||||
readonly root: string;
|
||||
readonly architecture: string;
|
||||
readonly processIdentity: Pick<
|
||||
MachoSlice,
|
||||
"architecture" | "cpu_type" | "cpu_subtype"
|
||||
>;
|
||||
readonly searchOverrides: readonly DyldSearchOverride[];
|
||||
readonly environmentRoots: Set<string>;
|
||||
readonly platforms: readonly number[];
|
||||
@@ -304,7 +307,7 @@ const evaluateCandidate = async (
|
||||
let outcome: Candidate["outcome"];
|
||||
if (facts.status !== "parsed") outcome = facts.status;
|
||||
else {
|
||||
const slice = compatibleSlice(facts.slices, context.architecture);
|
||||
const slice = compatibleSlice(facts.slices, context.processIdentity);
|
||||
if (slice === undefined) outcome = "architecture-missing";
|
||||
// Dependency commands require a dylib; generic dyld image loadability
|
||||
// also admits main executables and bundles for different operations.
|
||||
@@ -314,7 +317,7 @@ const evaluateCandidate = async (
|
||||
context.platforms,
|
||||
slice.platforms,
|
||||
slice.file_type_code,
|
||||
context.architecture,
|
||||
context.processIdentity.architecture,
|
||||
);
|
||||
outcome =
|
||||
platformResult === "compatible"
|
||||
@@ -470,11 +473,11 @@ const resolveDependency = async (
|
||||
resolved.image === null ? undefined : context.images.get(resolved.image);
|
||||
const slice =
|
||||
image?.status === "parsed"
|
||||
? compatibleSlice(image.slices, context.architecture)
|
||||
? compatibleSlice(image.slices, context.processIdentity)
|
||||
: undefined;
|
||||
return {
|
||||
root: context.root,
|
||||
architecture: context.architecture,
|
||||
architecture: context.processIdentity.architecture,
|
||||
loader,
|
||||
via: [...chain],
|
||||
...dependency,
|
||||
@@ -522,7 +525,7 @@ const traceProcess = async (
|
||||
const facts = context.images.get(image);
|
||||
const slice =
|
||||
facts?.status === "parsed"
|
||||
? compatibleSlice(facts.slices, context.architecture)
|
||||
? compatibleSlice(facts.slices, context.processIdentity)
|
||||
: undefined;
|
||||
if (slice === undefined) continue;
|
||||
context.loaded.set(image, {
|
||||
@@ -593,7 +596,11 @@ export const traceDylibLoading = async (
|
||||
{
|
||||
view,
|
||||
root,
|
||||
architecture: slice.architecture,
|
||||
processIdentity: {
|
||||
architecture: slice.architecture,
|
||||
cpu_type: slice.cpu_type,
|
||||
cpu_subtype: slice.cpu_subtype,
|
||||
},
|
||||
searchOverrides,
|
||||
environmentRoots,
|
||||
platforms: slice.platforms,
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/** CPU subtype bits reserved for ABI/capability flags, not the base subtype. */
|
||||
const CPU_SUBTYPE_CAPABILITY_MASK = 0xff000000;
|
||||
|
||||
/** Return the CPU subtype identity shared across capability-flag variations. */
|
||||
export const machoCpuSubtypeBase = (cpuSubtype: number): number =>
|
||||
cpuSubtype & ~CPU_SUBTYPE_CAPABILITY_MASK;
|
||||
Reference in New Issue
Block a user