Verify the signed desktop boot and executable linkage
@@ -62,6 +62,12 @@ At Vinix revision `7f173671`, a fresh x86_64 root installed `vinix-release-deskt
6262
6363To check the clean install before allocating disk space for the image, pass `--install-only` to `python3 tools/desktop-root.py "$arch" "$repo" "$auditor" "$work" "$fingerprint"`. When assembling the image later, run `python3 tools/stage-image.py "$arch" "$work/client" "$repo" "$work/image" "$auditor" "$fingerprint"` against that same audited client.
6464
65+The x86_64 release kernel booted that same 70-package client from ext2 with the five checksum-pinned Vinix native programs from the November 28 release. The guest read the ext2 identity, reached the registration screen and sampled at least 24 framebuffer colors. See `foundation/desktop-cold-guest-x86-01`, receipt SHA-256 `0c5b9bfae72837102bec49cf86e6422dc133466b121d951adf2cda14e6f95a5f`. The checksum-verified disk archive and restoration metadata are in `foundation/archived-desktop-cold-disk-02`, receipt SHA-256 `463aa01ddb1ced471b0bc4dce635a660982ba7181ba6a5b8f8a454f43e35cea5`.
66+
67+The packaged musl loader relocated all 150 dynamically linked position-independent executables from that client under PRoot. The `--fixed-address-report` option of `tests/exec-linkage.py` listed 24 GCC executables separately for direct execution. The GCC guest fixture exercises compiler drivers, compiler internals and runtime libraries through C, C++ and LTO builds. See `foundation/desktop-loader-cold-x86-02`, receipt SHA-256 `5d5487ba68828b33f7e73957b14249c4b8b1ec414ae278ccbeb319d1931c001b`.
68+
69+The same client's file ownership and exported-symbol comparison against the published initramfs is in `foundation/release-roots-audit-cold-01/x86_64`, receipt SHA-256 `53c9dada6393e3608bd24bfed1f27d194271861f747b023a734ed121f2681e9b`. The comparison found full export coverage at 60 library paths, export differences at eight, and one absent provider for Alpine's `libapk`.
70+
6571The worker resolved all 81 packages in `foundation/xlib-combined-01/repo` into seven stages. For example, BusyBox follows musl and Linux headers, Xlib follows XCB and Xtrans, and the bitmap fonts follow mkfontscale. The order is in `foundation/xlib-order-01/order.tsv` with SHA-256 `51d1464a0a994328c40264105f8b95b7b22a8922cad177daef98e593d4a6930c`. The first signed ARM feed puts both musl and Linux headers in stage zero. Its signed, installed root passed the ownership and ELF audit for 1,165 files and links, including six target ELFs. The worker keeps that receipt in `arm/common/sdk-01-audit.log` with SHA-256 `b315f8d20f2d4c7737fd2e5078c33e12b6183d2ee86a22a9ba6db6852d68c59b`.
6672
6773## Running the shared worker
@@ -12,14 +12,15 @@ import tarfile
1212import tempfile
1313
1414
15-def interpreter(path):
15+def executable(path):
1616 with path.open("rb") as stream:
1717 header = stream.read(64)
1818 if header[:4] != b"\x7fELF":
1919 return None
2020 if len(header) != 64 or header[4:6] != bytes((2, 1)):
2121 raise ValueError(f"unexpected ELF header in {path}")
22- if struct.unpack_from("<H", header, 16)[0] not in (2, 3):
22+ kind, = struct.unpack_from("<H", header, 16)
23+ if kind not in (2, 3):
2324 return None
2425 offset, = struct.unpack_from("<Q", header, 32)
2526 stride, count = struct.unpack_from("<HH", header, 54)
@@ -27,15 +28,15 @@ def interpreter(path):
2728 raise ValueError(f"invalid ELF program headers in {path}")
2829 stream.seek(offset)
2930 for _ in range(count):
30- kind, _, position, _, _, length, _, _ = struct.unpack("<II6Q", stream.read(stride))
31- if kind == 3:
31+ segment, _, position, _, _, length, _, _ = struct.unpack("<II6Q", stream.read(stride))
32+ if segment == 3:
3233 if length < 2 or length > 4096:
3334 raise ValueError(f"invalid ELF interpreter in {path}")
3435 stream.seek(position)
3536 raw = stream.read(length)
3637 if len(raw) != length or not raw.endswith(b"\0"):
3738 raise ValueError(f"truncated ELF interpreter in {path}")
38- return os.fsdecode(raw[:-1])
39+ return os.fsdecode(raw[:-1]), kind
3940 return None
4041
4142
@@ -47,11 +48,12 @@ def commands(arch, sdk):
4748 path = Path(directory) / name
4849 if path.is_symlink() or not path.is_file():
4950 continue
50- loader = interpreter(path)
51- if loader is not None:
51+ elf = executable(path)
52+ if elf is not None:
53+ loader, kind = elf
5254 if loader != expected:
5355 raise ValueError(f"unexpected interpreter {loader} in {path}")
54- yield [loader, "--list", "/" + path.relative_to(root).as_posix()]
56+ yield [loader, "--list", "/" + path.relative_to(root).as_posix()], kind
5557
5658
5759def release_probe(args):
@@ -75,9 +77,10 @@ def release_probe(args):
7577 with program.open("wb") as out:
7678 out.write(magic)
7779 shutil.copyfileobj(member, out)
78- interp = interpreter(program)
79- if interp is None:
80+ elf = executable(program)
81+ if elf is None:
8082 continue
83+ interp, kind = elf
8184 path = Path(entry.name.removeprefix("./"))
8285 if path.is_absolute() or ".." in path.parts or ":" in str(path) or "!" in str(path):
8386 raise ValueError(f"invalid guest bind path: {path}")
@@ -90,8 +93,6 @@ def release_probe(args):
9093 loader, "--list", "/" + str(path)], capture_output=True, text=True)
9194 diagnostic = " | ".join(result.stderr.splitlines())
9295 status = "failed" if result.returncode else "relocated"
93- with program.open("rb") as source:
94- kind, = struct.unpack_from("<H", source.read(18), 16)
9596 if kind == 2 and result.returncode and "Not a valid dynamic program" in diagnostic:
9697 # The loader's explicit --list entry cannot map some fixed-address
9798 # executables that do start through the kernel's normal ELF entry.
@@ -112,9 +113,20 @@ def main(args):
112113 subprocess.run([args.auditor, args.arch, args.client], check=True)
113114 if args.release:
114115 return release_probe(args)
115- entries = sorted(commands(args.arch, args.client))
116+ entries = []
117+ fixed = []
118+ for command, kind in sorted(commands(args.arch, args.client)):
119+ if kind == 2 and args.fixed_address_report:
120+ fixed.append(command[-1])
121+ else:
122+ entries.append(command)
116123 if not entries:
117124 raise ValueError("root has no dynamically linked executables")
125+ if args.fixed_address_report:
126+ with args.fixed_address_report.open("x") as output:
127+ for path in fixed:
128+ output.write(path + "\n")
129+ print(f"{len(fixed)} fixed-address executables require direct execution")
118130 if args.fixture:
119131 with args.fixture.open("x") as output:
120132 output.write("#!/bin/sh\nset -eu\nexport LC_ALL=C\nunset LD_LIBRARY_PATH LD_PRELOAD\n"
@@ -140,6 +152,8 @@ if __name__ == "__main__":
140152 parser.add_argument(arg, type=lambda p: Path(p).resolve())
141153 parser.add_argument("--fixture", type=Path, help="write a guest script for the Vinix boot harness")
142154 parser.add_argument("--proot", type=Path, help="also check a host-architecture root in unprivileged PRoot")
155+ parser.add_argument("--fixed-address-report", type=Path,
156+ help="list fixed-address executables separately for direct execution checks")
143157 parser.add_argument("--release", nargs=3, metavar=("ARCHIVE", "SHA256", "REPORT"),
144158 help="bind each original release executable over its guest path and record relocation results")
145159 options = parser.parse_args()
@@ -149,4 +163,6 @@ if __name__ == "__main__":
149163 parser.error("use the Vinix guest fixture for a foreign architecture")
150164 if options.release and (not options.proot or options.fixture):
151165 parser.error("--release requires --proot and an independent report path")
166+ if options.release and options.fixed_address_report:
167+ parser.error("--release already reports which executables require direct execution")
152168 raise SystemExit(main(options))