WebKit's GPU process could not load our Metal bundle on arm64 guests, so
every WebGL context in Safari was lost as it was made. Its sandbox profile
lets it read /Library/GPUBundles but maps nothing executable there, and on
arm64e each MAC policy's op is called on its own: RgfxGate answered AMFI's
file_check_mmap for the bundle, and Sandbox's still refused the mapping
("file system sandbox blocked mmap()"). On x86-64 the route is the
dispatcher itself, so Sandbox was never asked. replayd is refused the same
way.
Graft 0.3.0 routes another policy's op by a "<policy>:" prefix. RgfxGate
now routes "Sandbox:file_check_mmap" in a call of its own, with the AMFI
route's rule (an executable mapping of one of the bundle executable's
cdhashes, maxprot clamped to prot) and Sandbox's own original for
everything else. A Graft that refuses the route leaves the AMFI routes in
place and logs that sandboxed processes cannot map the bundle. amfi_test
holds the route's name; it indexes past the policy's prefix, since clang's
-Wstring-plus-int refuses adding to the literal. x86-64 is unchanged.
From steelbrain/appwalk3-sbx (58c059be7, df27bdc99).
43 lines
2.1 KiB
C++
43 lines
2.1 KiB
C++
// Native test that pins the arm64 AMFI route facts (src/rgfx_amfi.h): the three
|
|
// admission operation names and the pointer-authentication discriminators AMFI
|
|
// signs their slots with. These are measured ABI constants, uniform
|
|
// across the five config-2 Boot KCs (Ambrosia 2026-11-08) and matched by Graft's
|
|
// own route layer; a stray edit to either side must fail the build, so this test
|
|
// holds the literal values and the cross-checks that tie them together. Build
|
|
// and run with `make test`.
|
|
#include "rgfx_amfi.h"
|
|
#include <cassert>
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
|
|
int main() {
|
|
// The discriminators AMFI signs each mac_policy_ops slot with (key IA, no
|
|
// address diversity). These are the same values Graft's Arm64Route operation
|
|
// table carries, and each replacement's type must have its slot's
|
|
// (RgfxGateHooks.cpp's static_asserts).
|
|
assert(kRgfxAmfiDiscFileCheckMmap == 0x438d);
|
|
assert(kRgfxAmfiDiscLibraryValidation == 0x9e37);
|
|
assert(kRgfxAmfiDiscVnodeCheckSignature == 0xcbd2);
|
|
|
|
// No two operations share a discriminator (each slot is distinct).
|
|
assert(kRgfxAmfiDiscFileCheckMmap != kRgfxAmfiDiscLibraryValidation);
|
|
assert(kRgfxAmfiDiscFileCheckMmap != kRgfxAmfiDiscVnodeCheckSignature);
|
|
assert(kRgfxAmfiDiscLibraryValidation != kRgfxAmfiDiscVnodeCheckSignature);
|
|
|
|
// The operation names graft_route_request.symbol carries on arm64: the bare
|
|
// operation, no "_mac_" or "mpo_" prefix (Graft maps each to its mpo field).
|
|
assert(strcmp(RGFX_OP_FILE_CHECK_MMAP, "file_check_mmap") == 0);
|
|
assert(strcmp(RGFX_OP_LIBRARY_VALIDATION, "file_check_library_validation") == 0);
|
|
assert(strcmp(RGFX_OP_VNODE_CHECK_SIGNATURE, "vnode_check_signature") == 0);
|
|
|
|
// The Sandbox policy's file_check_mmap: its registered name ("Sandbox", the
|
|
// mpc_name Graft finds it by), a colon, and the bare operation AMFI's route
|
|
// names, so the two routes name one operation on two policies.
|
|
assert(strcmp(RGFX_OP_SANDBOX_FILE_CHECK_MMAP, "Sandbox:file_check_mmap") == 0);
|
|
assert(strcmp(&RGFX_OP_SANDBOX_FILE_CHECK_MMAP[strlen("Sandbox:")], RGFX_OP_FILE_CHECK_MMAP) ==
|
|
0);
|
|
|
|
printf("amfi_test: ok\n");
|
|
return 0;
|
|
}
|