Repository navigation
fix(relinker): reject needed companion output collisions - #6115
Conversation
|
Tested on Linux x86-64 (Release build), with 62b0901 merged into main ab9a476. This covers the Linux execution paths that were skipped on Windows:
AI-assisted: yes (Claude Code) |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
@eliyarson I confirmed the overlap with #6314 using Git tree-only merge previews against main Would #6115 first, followed by rebasing #6314 and retaining both entries, work for you? Neither implementation requires the other. I have left |
MrMha
left a comment
There was a problem hiding this comment.
Reviewed exact head 62b09018d4676bf385d4744e982f13e330416359 on macOS 27.0.1 arm64, the local case-insensitive filesystem, AppleClang 21, Python 3.12.14, CMake 4.4.4/Ninja 1.13.2; Release relinker-only build.
- Built the relinker and all targets in the relinker-only configuration. Full CTest run: 163/163 pass.
- Focused verbose run:
output_collisionsandsecondary_output_collisionspass (49 and 48 hard-link pairs respectively, plus direct paths and identity controls). The distinct case-variant acceptance branch explicitly skips because this filesystem is case-insensitive. The checks cover both ELF and Windows output conversion; this does not mean a Windows binary ran on macOS. - Negative control: retained the exact PR tests and restored only
core/relinker/main.cppfromHEAD^, then rebuilt the relinker. Both focused tests fail: the direct companion/executable overlap and the needed-companion/secondary-executable hard-link case incorrectly return 0 instead of rejecting the collision. - Checked the write ordering: every
neededPathsdestination now reaches the existing destination-identity collision check before diagnostics, guest modules, executables, registries or companion files are written. The focused tests verify sentinel output bytes and input bytes remain intact on rejection, while distinct-destination controls still convert successfully.
I found no blocking issue in this narrow addition. This validates the exact PR head, not current-main composition with other open PRs. No full system-library build, game/homebrew execution, or GPU test was performed.
AI-assisted review and local testing: OpenAI Codex.
|
Checked on the PR merged onto current |
|
@jotitadev I confirmed the #6927 overlap against main Given the maintainer's #6115-first merge note above, would #6115 first and #6927 rebased afterward work for you? The later branch can then record the agreed order in This pass used source inspection and Git tree-only merge previews; I did not run a combined build or those tests. The complete 762-PR inventory and changed-file lists were checked; the final refresh had 761 PRs after an unrelated closure, with these heads and main unchanged. AI-assisted: Codex. |
What
Include
.needed.jsoncompanion files in the relinker's existing output collision preflight. With--registry --executable output.needed input.elf output.json, the secondary executable and the main dependency companion both targetoutput.needed.json. Current main returns success and replaces the converted executable with JSON. Existing hard-linked companion destinations can likewise overwrite other outputs.The collision check now rejects these destinations before writing any executable, module or companion. The existing regression suites cover new and existing direct collisions, every main/module companion hard-link pairing, secondary executable companion collisions, unchanged inputs and existing outputs, and successful distinct-file controls.
Depends on: none. Unblocks: none; synthetic regressions and the disclosed Mari0 conversion reproduction below. AI-assisted: yes (Codex).
Tested
Windows x86-64, OS build 10.0.26200.0; supported WinLibs MinGW-w64 GCC 15.2.0, CMake/Ninja Release. Synthetic Linux ELF and Windows PE conversion, plus the Mari0 package conversion below. No game, generated executable, GPU or Linux/macOS host execution was performed locally.
Baseline:
eea428ca855fb59a3edd394bab9abf99165590f1. Branch:fix/relinker-needed-output-collisions. Tested commit:62b09018d4676bf385d4744e982f13e330416359.output_collisionsandsecondary_output_collisionsfail because colliding conversions return 0; standalone reproducer confirms secondary output bytes are an empty JSON array instead of an executable.long_paths,LongPathsEnabledis not 1), 0 failures.output_collisionspassed in 3.57 s (49 hard-link pairs plus direct-name checks);secondary_output_collisionspassed in 5.98 s (48 hard-link pairs). Suite wall time 28.66 s with four workers.input_magicwas registered. Standalone reproducer now exits 2 withOutput paths collideand creates no output.git diff --check: passed.python tools/check_conventions.py --base origin/main: passed on the committed change.Commands (toolchain bin prepended to PATH; explicit Python points to the working local interpreter):
An additional 26 root CTests passed (6.75 s), selected after inspecting all 40 root registrations. Aggregate: 152 passed, one whole-test skipped, and 14 commit-producing tooling suites excluded from 167 registered tests. Internal subcase skips include one registration check, two hardware-oracle checks, and five release-packaging checks. The excluded suites are pr_overlap_encoding, pr_overlap_tools, pr_overlap_own_branch, progress_history, import_audit, conventions_function_bodies, conventions_wrapped_declarations, conventions_ci_gate, conventions_bom_shebang, conventions_body_bom, conventions_blob_reads, check_main_sync, debt_split, and check_compile. Full library/shader builds were not applicable. Distinct case-variant controls skipped on the case-insensitive Windows test directory. Input-preservation symlink cases skipped because Windows symlink privilege is unavailable; Linux-only execution portions skipped on this Windows host.
Homebrew evidence: Mari0 conversion
Mari0 1.6.2 from websrv v0.34 reproduces the overwrite during conversion. The original Mari0.zip ships
love.elfandlibOSMesa.so.8; its packaging script and launcher identify those files.Tested on Windows 11 x64, build 26200, Python 3.13.7 and WinLibs MinGW-w64 GCC 15.2.0 r7, Release relinker builds. Baseline:
eea428ca855fb59a3edd394bab9abf99165590f1. Fixed:62b09018d4676bf385d4744e982f13e330416359. These are the recorded test builds, not a claim of rerunning on later main.output.exeandoutput.needed.jsonhard-linked to one sentinel fileOutput paths collide; both paths retain their original bytes, no guest module writtenReproduce separately with the baseline and fixed binary, using a fresh output directory for each run. In a separate copy of the extracted package, add an empty
sce_moduledirectory; leave the shipped module in the package root. For the collision case, write a sentinel tooutput.exeand createoutput.needed.jsonas a hard link to it. For the control, leave both destinations absent. From that output directory, run:The empty directory,
--module-dir ., and--trap-sdk-syscall-stubsare disclosed accommodations needed by this payload homebrew layout. All original input file hashes remained unchanged across all four runs. The hard-link output condition was deliberately constructed; it is not part of Mari0's shipped layout or evidence of a reported user incident. This proves a conversion/output-preservation failure using the real package, not game startup, gameplay, or physical-PS5 behavior. Neither the game nor a generated executable was run.SHA-256:
Separately, coltken95 reports Linux x86-64 before/after validation: both collision regressions pass with this head merged into main
ab9a47684and fail using main'score/relinker/main.cpp. This is third-party validation, not a local Linux run.Evidence collection and this update were AI-assisted.
Unblocks: noneremains appropriate: no title bring-up or gameplay claim is made.Open PR comparison
Refreshed before this evidence-only description update: main
e858dbd78dbe87fd372f7097cc7759f2ee01e2a2, complete 517-PR inventory across six pages, and complete paginated changed-file lists. Each head was normalized against that main; pairwise tree-only Git merge previews used that exact main as the explicit merge base. No temporary commits were created. This PR merges cleanly with main; all six comparisons among our four open PRs are clean. This does not claim combined compilation/runtime validation.#6156 changes guest-module directory identity, #5695 changes executable permissions after writing, and #6127 changes output identity helpers, registry naming and emission/progress. None adds neededPaths to outputPaths. #6127 overlaps behavior despite a clean textual merge: its diff removes needed-companion writes and changes the identity helper. The combined runtime behavior was not validated; merge success alone is not compatibility evidence.
006e1768128d23f491e78d51c709ecf58d97ed2c: clean pair preview. Shared files:core/relinker/main.cpp.8166150bd987ff4d60e525f665e9b054de6d9fb5: clean pair preview. Shared files:core/relinker/main.cpp.acc228ab4a54fbdc0c816c22b52b82968e42649b: clean pair preview. Shared files:core/relinker/main.cpp.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)