test(relinker): cover symbol range boundaries #1690
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1690"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Sanjaysrinivas on 2026-10-08T16:33:49Z.
What
Refs #1666. Depends on #1272. This PR adds complementary integration regressions and documentation. The prerequisite's original commit,
42e8a2a219ed3ac7f60ba259312cb3b2ee30dcdd, is merged into this branch with its original author and history, so CI tests the dependency and our changes together. No competing bounds implementation was written. Upstreammain,17350cf5fd54ad5c79ee495ed8e8615f4663bbd6, is an ancestor.Keep this PR dependent on #1272; once it merges, rebase onto updated main so the remaining review covers only complementary tests and documentation. This PR does not independently close #1666.
CI fix #1717 (now superseded by merged #1715) isolates
agc_driver_flat_storewith CTestRUN_SERIAL, following the existing constant-store test isolation. Its original commit158ae1ffis included. This unchanged GPU test timed out at 120.09 s during parallel Linux CI; main's first execution had already taken 117.11 s, compared with 73.10 s before parallel scheduling, and subsequent executions took 7-10 s. The timings are consistent with expensive cold software-GPU compilation and CPU contention; they do not establish a driver deadlock. The one-line fix retains the existing timeout, byte checks, dispatches and repetitions. The equivalent scheduling fix has merged into main through #1715, so #1717 is closed and is no longer an outstanding dependency. Its commit remains in this validated branch history; rebasing after #1272 merges will drop the duplicate change.Overlap coordination: #1446 implements a separate RELA table-range guard. The shared CMake insertion point was resolved by moving the included
dynamic_table_boundsregistration within its existing Linux-only scope;git merge-tree --write-tree HEAD origin/pr-1446now merges cleanly against4da534fed782d12444f4c3f016e2b333dde15438. It is not a prerequisite. #1682 is an alternative implementation of the symbol guard already supplied by #1272, and cannot be stacked unchanged with it. This PR retains the explicitly declared #1272 dependency; if upstream selects #1682 instead, rebase the complementary tests/documentation onto that merged fix and remove the #1272 prerequisite from the branch. Do not merge both alternative guards.R_X86_64_64,GLOB_DAT,JUMP_SLOT, bases past EOF/nearUINT64_MAX, indexed sums wrapping into readable bytes, the largest symbol index, truncated name fields, exact EOF boundaries and invalid strings. Invalid lookups require exit 2, the expected diagnostic, and neither an executable nor a registry; crashes and unrelated errors fail. Successful controls check the output format, emitted import name and registry relocation type/offset/target.st_namecontract indocs/dev/ARCHITECTURE.md. A four-byte field ending at EOF passes import lookup and Linux conversion; Windows subsequently requires complete symbol records during TLS code analysis. The Windows boundary control requires the import registry followed by that specific controlled rejection. Complete 24-byte EOF records succeed in both output modes.dynamic_table_boundstest. The adjacent audit verified sharedrelaEntryPos, dynamic-segment/string/JMPREL bounds and Windows load-range checks. Record two independently reproduced Linux segment gaps inTechnicalDebt.md: unchecked virtual-to-file offset addition and unchecked segment-end addition. They are scoped follow-ups, not fixes in this PR. Empty RELA table-range work remains with #1446.On the unpatched
4b005b229e24be9ec3f185def9e59cbc03aa9e4abaseline, 16 assertions fail: maximum bases produce unrelated string errors, and wrapped indexed offsets produce four Linux executables instead of rejecting the input. With #1272's guard, all 86 conversions pass.Tested
Current source:
1a8de5e4193ed07edb27ea7c9dde25d031573e1e, containing our documentation/tests commite0178bd4f6ad925753fef916782a32d0fd224c3e, prerequisite42e8a2a219ed3ac7f60ba259312cb3b2ee30dcdd, current main, the CMake registration move, and #1717's GPU-test scheduling change. Local Release suites below passed with--parallel 6atb8940e8d(Windows) ande3899a0d(Linux), before adding #1717, which changes only GPU test scheduling. GitHub CI on the complete current stack passes every build job; all current applicable PR checks pass. The sanitizer and allocator results below were established during the initial investigation against the same production source and symbol guard. Synthetic fixtures; no game files.15.2.0posix-14.0.0-ucrt-r7, Release, Ninjadynamic_table_bounds, existingrela_bounds, optional/empty PLT and stringscore/libs/tests/Mspace.cpp, linked directly with productionMspace.cppandProcess.cppCommands (same relinker configuration on both hosts):
On Windows the binary is
relinker.exe. The instrumented executable was built from the samecore/relinkerCMake target in a temporary parent project with-fsanitize=address,undefined -fno-omit-frame-pointer -fno-pie, dynamic linking and-no-pie;ASAN_OPTIONS=detect_leaks=1:halt_on_error=1andUBSAN_OPTIONS=halt_on_error=1. No sanitizer infrastructure is added to the repository (#1669 owns that work).Allocator command from the repository root:
The sanitizer allocator build uses
-O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-pie -no-pieinstead of-O3 -DNDEBUG. Native Windows allocator linking and the full system-library/title suite were not verified.Reproducer for the two adjacent Linux gaps recorded in technical debt
Run from the repository root, with the built relinker as the first argument. These cases are informational follow-ups and are not registered as regressions for this change. Main and this documentation/test branch both accept the malformed Linux images; Windows rejects them. This demonstrates wrong-source translation/output validity, not a newly established out-of-buffer read or title crash.
Observed for both cases: Linux
exit=0 output=True. Windows:exit=2 output=False, respectivelyInvalid PT_LOAD file rangeandPT_LOAD address overflow. Source locations are linked indocs/dev/TechnicalDebt.md; the invalid load headers are retained in the Linux output.Checklist
main; complementary changes extend #1272, whose original prerequisite commit is included with attribution.mdfiles or images added to the repository; durable documentation updates existing developer filesImported from boykopovar/AnyPS5. Originally posted by Sanjaysrinivas on 2026-10-08T17:20:19Z.
Follow-up to the overlap report, addressed at
b8940e8d55a01a42ca5d2a0a36f2fcdb133ccdfe:dynamic_table_boundsregistration within its existing Linux-only condition, preserving the target and test.git merge-tree --write-tree HEAD origin/pr-1446now succeeds against #1446 head4da534fed782d12444f4c3f016e2b333dde15438. Its RELA table-range fix is independent of these symbol regressions, so it is not a dependency.7995d6578d289310c25b8e104119c8bbfabb14f9, while retaining #1272's original authorship/history. Updated the PR description with this coordination and the latest tested commit.Validation on the pushed head: full Release relinker suites 40/40 Linux (Ubuntu 24.04/WSL2, GCC 13.3) and 37/37 Windows (MinGW-w64 GCC 15.2), both with
ctest --parallel 6 --output-on-failure --timeout 120. The 86 symbol conversions pass on both hosts. Conventions andgit diff --checkpass. The updated head starts a fresh GitHub CI run; earlier successful checks apply to the previous head.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T17:40:06Z.
Verified on Linux against today's
main(2b297842), replaying the declared order, and the key result is that your two new tests genuinely gate the bound rather than merely passing beside it.Replay and build
Negative control — the part I actually care about. Implementation reverted to
main'sif (symOff + 4 > raw.size()), both new tests kept:So the wrapped
base + index * 24cases you added fail on the unbounded code, which is what a regression for this fix has to do.Coverage is real, not decorative. The fixture labels in
test_symbol_ranges.pycoverbase-max,base-max-minus-one,base-past-eof,indexed-past-eof,indexed-wrap,indexed-wrap-to-valid-name,index-max,name-at-eof,name-one-byte,name-two-bytes,name-three-bytes,name-outside-strsz, thesysv-/os-/plt-tag families, and anunchanged-relative-controlplus--registrypath. That matches theDT_SYMENT/st_name-only reasoning in theARCHITECTURE.mdtext — in particular that a readablest_nameending exactly at EOF passes import lookup, which is the subtlest of the boundary cases and is asserted rather than described.The bot's overlap flag is stale.
git merge-tree --write-tree <merged pair> pr-1446exits 0 with zero conflicts against #1446's head, so the CMake insertion-point issue you addressed atb8940e8dholds up. (#1682's overlap is moot: @MarcZX100 closed it as a duplicate of #1272.)One process note, not a code issue. The rollup shows
relinkergreen on ubuntu/windows/macos, andlinux/windowsempty — those are the two Build jobs, which is theaction_requiredstate, not a failure: a fork'spull_requestrun waits for a maintainer to approve it (issue #1631 counts 38 heads in that state today). So theUNSTABLEmerge status is purely the unapproved runs.This depends on #1272, so it should land after it; the pair applies in that order without conflict on current
main.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by Sanjaysrinivas on 2026-10-08T17:44:33Z.
The Linux CI failure is addressed, and all current applicable checks pass on
1a8de5e4193ed07edb27ea7c9dde25d031573e1e.The failed job compiled successfully but timed out in the unchanged
agc_driver_flat_storeGPU test at 120.09 s after CI enabled parallel testing. Main had already taken 117.11 s on that test's first execution; subsequent executions took 8-10 s. The same test previously took 73.10 s under serial scheduling. These timings are consistent with costly cold software-GPU compilation under CPU contention, rather than a symbol-bounds failure.The one-line CTest isolation change lives in separate draft #1717 and is included here as an explicit prerequisite, preserving one-topic review. It leaves the byte checks, all dispatches, repetitions and 120-second timeout intact. Both prerequisites are now listed: Depends on #1272 and #1717. Rebase away their included commits once they merge.
Validation of the complete stack:
Capability-based GPU skips remain visible. #1717 also passes its independent full Linux and Windows checks. The PR description now records the latest commit, dependency and results.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:55:14Z.
Closing: these tests belong with the fix in #1272, and the branch carries merge commits and #1717's change. Once #1272 is in, a PR with only the tests, rebased onto main, is welcome.
Pull request closed