Commit Graph
1067 Commits
Author SHA1 Message Date
Adrià b1f023dda3 Merge pull request #9486 from harisibrar1/fix/relinker-dlltool-temp-prefix
build(relinker): give dlltool a short temporary prefix for the msvcrt import library
2026-10-25 19:29:55 +01:00
Dean 309912635e Merge pull request #10732 from roboterspinne/fix/relinker-guest-tls-export-references
fix(relinker): reject non-TLS guest relocations bound to a guest TLS export
2026-10-26 05:58:59 +13:00
Dean 6b1f419fef Merge pull request #10731 from roboterspinne/fix/relinker-guest-tls-special-sections
fix(relinker): reject guest TLS symbols in special sections
2026-10-26 05:57:35 +13:00
Dean d7493d7226 Merge pull request #10713 from Filip722/fix/reject-lock-movnts-20261024
fix(relinker): reject LOCK-prefixed MOVNTSS and MOVNTSD
2026-10-26 05:57:30 +13:00
Dean fe7e460568 Merge pull request #10752 from roboterspinne/fix/relinker-conflicting-dynamic-tags
fix(relinker): reject conflicting duplicates of the dynamic tags the pipeline reads
2026-10-26 05:49:08 +13:00
Dean 636a9c1eec Merge pull request #10730 from roboterspinne/fix/relinker-tls-relocations-empty-pt-tls
fix(relinker): require a non-empty PT_TLS for executable TLS relocations
2026-10-26 04:45:22 +13:00
Dean 16ff208dc3 Merge pull request #10646 from roboterspinne/fix/relinker-executable-export-bounds
fix(relinker): reject executable exports outside PT_LOAD and PT_TLS memory
2026-10-26 00:03:56 +13:00
Dean 28d2a461d2 Merge pull request #10710 from roboterspinne/fix/relinker-windows-gs-branch-targets
fix(relinker): refuse branches into trapped guest GS instructions on Windows
2026-10-25 21:50:25 +13:00
Dean 268674d31c Merge pull request #10682 from ahmadmuj/fix/relinker-verify-frame-red-zone
fix(relinker): reject --frame-red-zone with --verify-patches
2026-10-25 21:50:21 +13:00
Dean 2f5013ec64 Merge pull request #10658 from roboterspinne/fix/relinker-reject-copy-relocations
fix(relinker): reject R_X86_64_COPY relocations
2026-10-25 21:50:12 +13:00
Dean 5aa203ba74 Merge pull request #9663 from AdnanKhan-ak47/feat/relinker-report-unconverted-needed
feat(relinker): report needed modules shipped outside the module directories
2026-10-25 21:50:08 +13:00
Dean 1da5d1a757 Merge pull request #10709 from roboterspinne/fix/relinker-executable-needed-names
fix(relinker): reject executable DT_NEEDED names the guest reader rejects
2026-10-25 21:37:44 +13:00
Adnan Khan 37c516ad2e fix(relinker): keep the needed-module report best-effort on traversal and status errors 2026-10-25 12:24:22 +05:30
Dean a512780d58 Merge pull request #10340 from Filip722/submit/lock-20261023
fix(relinker): reject LOCK-prefixed SIMD lowerings
2026-10-25 13:28:53 +13:00
Dean c4446bbb09 Merge pull request #9332 from rooklz/fix/windows-console-base
fix(relinker): prefer 0x400000 for Windows executables
2026-10-25 12:57:28 +13:00
Dean 38d463a6cf Merge pull request #10157 from Usama171/fix/relinker-preloaded-crt-log
fix(relinker): rebind a preloaded CRT's standard streams to the startup log
2026-10-25 12:45:29 +13:00
harisibrar1 bae010daa7 Merge main c8d34aa8f4 into fix/relinker-dlltool-temp-prefix 2026-10-24 18:43:37 -04:00
roboterspinne 76e32bca2d fix(relinker): reject conflicting duplicates of the dynamic tags the pipeline reads
getTagValue returned the first entry of a dynamic tag, so an executable
with DT_RELASZ 0 followed by DT_RELASZ 24 converted for Linux with exit
0 and an output without DT_RELA, while the reverse order kept the
relocation. getTagValue now scans every entry and throws "Conflicting
duplicate <NAME> tags" when a tag it is asked for repeats with a
different value, the rule RelativeRelocationIndex already applies with
unused-filter=1. The pipeline check accepts a repeat with the same
value: it is not ambiguous, and #1938, which rejected it, was closed
because no title was shown and because rejecting it could refuse an
input the console loads. The code analysis on Windows and macOS and the
strict filter keep their own duplicate checks. Inputs without such a
conflict convert as before, and an input with one now fails with the
same message on every target.
2026-10-24 23:13:28 +02:00
roboterspinne 484cb7b539 fix(relinker): require a non-empty PT_TLS for executable TLS relocations
An executable's local TPOFF64, DTPOFF64 or DTPMOD64 relocation passed
whenever a PT_TLS header existed, so the Linux targets emitted it next
to a PT_TLS with p_memsz 0, while the Windows and macOS relocation
builder rejected the same input. glibc's ld.so sets up the main
program's TLS module only for a PT_TLS with p_memsz > 0, so such a
relocation has no block to resolve against. The pipeline now requires a
PT_TLS with a nonzero p_memsz and fails on every target with "TLS
relocation in an executable without a non-empty PT_TLS segment".
Relocations against imported TLS symbols are unchanged.
2026-10-24 21:42:14 +02:00
roboterspinne cd7b8bff00 fix(relinker): reject non-TLS guest relocations bound to a guest TLS export
A guest STT_NOTYPE import that resolved to another guest's STT_TLS
export was accepted when R_X86_64_64, R_X86_64_GLOB_DAT or
R_X86_64_JUMP_SLOT referenced it, and every target filled the slot
with an address that is not the variable. The gABI lets only TLS
relocations reference an STT_TLS symbol; the reader already rejects
such relocations against a TLS-typed import, and the builder rejects
OBJECT and FUNC imports of a TLS export as a type mismatch. The
builder now also rejects a referenced NOTYPE import of a guest TLS
export with "Non-TLS relocation against guest TLS export". These
inputs exit 2 on Linux, Windows and macOS instead of producing
outputs; unreferenced NOTYPE entries and TLS relocations are
unchanged.
2026-10-24 21:36:27 +02:00
roboterspinne 21127fe316 fix(relinker): reject guest TLS symbols in special sections
GuestImageReader rejected a defined symbol whose section index is
SHN_LORESERVE (0xff00) or higher, SHN_ABS excepted, only when it was
not STT_TLS, so a TLS symbol in SHN_ABS, SHN_COMMON, 0xff00 or
SHN_XINDEX was accepted. The Linux output kept it in .dynsym with that
section index, Windows and macOS failed only for an export outside
SHN_ABS, and both wrote st_value plus addend for a DTPOFF64 relocation
against a local one. The gABI gives a defined STT_TLS symbol its
assigned TLS offset and no meaning in a special section index, so
every such symbol now fails with "Unsupported special symbol section"
before the TLS bounds check. SHN_ABS stays accepted for other symbol
types.
2026-10-24 21:33:20 +02:00
muaus 91bd250e98 test(relinker): wait for the terminated child to leave the process snapshot 2026-10-25 00:10:24 +05:00
Filip Michalski 50dc1c93c8 fix(relinker): reject LOCK-prefixed MOVNTSS and MOVNTSD 2026-10-24 20:43:16 +02:00
Filip Michalski cfa8c10d21 fix(relinker): clarify LOCK SHA failures and cover conversion 2026-10-24 20:43:14 +02:00
roboterspinne 0ba2ca7982 fix(relinker): reject executable DT_NEEDED names the guest reader rejects
The pipeline read an executable's DT_NEEDED names with readCStr and
checked only bounds and the NUL terminator, so without bundled modules
an empty name, $LIB.prx, a:b.prx or a name with CR or LF relinked with
exit 0 and reached the Linux DT_NEEDED unchanged, while the Windows and
macOS outputs each rejected a different subset. The DT_NEEDED loop now
applies the rule GuestImageReader applies to a module's DT_NEEDED: a
name is not empty and contains no backslash, colon, dollar, CR or LF; a
slash stays allowed. Such an executable now fails on every target with
"Invalid dependency: <name>" at the name's file offset, and outputs for
valid names do not change.
2026-10-24 20:20:26 +02:00
roboterspinne 7424949b8b fix(relinker): refuse branches into trapped guest GS instructions on Windows
Windows output replaced each guest GS memory instruction with UD2 and
NOP fill without checking the decoded direct branch targets, so a branch
past the first byte of such an instruction was converted and landed in
the second UD2 byte or the NOP fill. A branch target strictly inside a
trapped GS instruction is now refused with "Branch enters a guest GS
instruction", the rule macOS applies since #7706 and this builder
already applies to its FS rewrites. The branch targets are sorted before
the trap loop, which runs before the PT_TLS early returns, so images
without PT_TLS are covered; guest modules go through the same builder. A
branch to the first byte still converts and reaches the UD2.
2026-10-24 20:18:50 +02:00
Ahmad Mujahid 73a681b488 fix(relinker): reject --frame-red-zone with --verify-patches 2026-10-24 21:33:31 +04:00
Adrià d01070d6c3 Merge pull request #5640 from EagleBearerYS/feat/relinker-frame-frameless-leaves
feat(relinker): frame red-zone leaves without a frame pointer by moving their rsp operands
2026-10-24 18:14:53 +02:00
Dean 5c90b0a65e Merge pull request #9228 from savvaniss/feat/log-deferred-imported-modules
feat(relinker): log deferred Windows modules the executable imports from
2026-10-25 05:10:41 +13:00
muaus 214792139f test(relinker): start the stub-after-CRT log case from a stale anyps5.log 2026-10-24 21:01:09 +05:00
muausandClaude Fable 5 eeaf7b03b5 fix(relinker): open the startup log for append so stub writes cannot clobber CRT output
Co-Authored-By: Claude Fable 5 <[email protected]>
2026-10-24 20:30:27 +05:00
roboterspinne 7f58c7a407 fix(relinker): reject R_X86_64_COPY relocations
The Linux output writes every import symbol with st_size 0 and copies
a COPY relocation into the output unchanged, so ld.so copies
MIN(st_size of the definition, 0) = 0 bytes and the variable stays
zero. Windows and macOS already rejected the type in the relocation
builder. ValidationPolicy now rejects type 5 before any target code,
so every target reports the same error, and the COPY case of the
fixed-base rebasing, which validation makes unreachable, is gone.
2026-10-24 17:16:23 +02:00
Rookie 39df8e081c fix(relinker): prefer 0x400000 for Windows executables 2026-10-24 15:58:35 +01:00
Dean a8c8b8117b Merge pull request #8900 from WhiteAssassins/feat/patch-advisor
feat(tools): recommend verified local game patches
2026-10-25 03:51:47 +13:00
roboterspinne f1a7f913c7 fix(relinker): reject executable exports outside PT_LOAD and PT_TLS memory
An exported symbol of the executable must lie inside a PT_LOAD segment,
executable for STT_FUNC, together with its size and at least one byte.
A non-TLS export in SHN_ABS is exempt from the range check, and any
other special section index is rejected. An STT_TLS export needs a
regular section index and a PT_TLS header and must lie inside it.

GuestImageReader applies the PT_LOAD, PF_X and PT_TLS bounds to every
symbol of a guest module, and the macOS target applied the bounds and
the section rule to the executable's exports. Linux rejected only a
special section index at a fixed base, and Windows only an STT_FUNC
export with a nonzero size outside the code, in code analysis; every
other export was copied into the output unchecked. The check now runs
in the pipeline, so every target reports the same error for an export
it rejects, and the macOS export test expects that message.
2026-10-24 16:26:59 +02:00
Savvanis SpyrosandClaude Opus 5.5 66ccd46909 Merge remote-tracking branch 'origin/main' into feat/log-deferred-imported-modules
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 16:35:28 +03:00
Adrià b84322da6a Merge pull request #7918 from Kernel-Hunter/fix/rosetta-xsaveopt
fix(relinker): rewrite XSAVEOPT to XSAVE under --to-rosetta
2026-10-24 14:14:59 +02:00
Adrià 3fcacfbc0d Merge pull request #7822 from yash27git/fix/refuse-truncated-branch-rewrites
fix(relinker): guard length-changing rewrites around truncated branches
2026-10-24 14:14:54 +02:00
Dean a011db7048 Merge pull request #8142 from Kernel-Hunter/fix/rosetta-masked-stores
fix(relinker): probe masked store elements before the store under --to-rosetta
2026-10-25 00:56:00 +13:00
muaus c2937ec9b2 test(relinker): fail child-leak checks on enumeration or cleanup errors 2026-10-24 16:18:43 +05:00
Adrià ac28b89bd9 Merge pull request #7706 from Destroyers212x/fix/macos-gs-trap-branch-target
fix(relinker): refuse branches into trapped guest GS instructions on macOS
2026-10-24 12:54:07 +02:00
Adrià a0a8ef2fd5 Merge pull request #7837 from muteburrito/test/relinker-embedded-code-data
test(relinker): characterize embedded code data scanning
2026-10-24 12:53:05 +02:00
Adrià 50aa1798e7 Merge pull request #7741 from MarcZX10/codex/macos-main-thread-mxcsr
fix(relinker): initialize MXCSR in macOS guest entry
2026-10-24 12:51:40 +02:00
Dean 622adaccc1 Merge pull request #10241 from Bram910/fix/registry-offset-locale
fix(relinker): keep registry offsets independent of host locale
2026-10-24 23:40:01 +13:00
muaus 38123265f7 test(relinker): reap the suspended child when runtime preloading fails 2026-10-24 15:07:16 +05:00
Dean bc559d4c98 Merge pull request #10342 from Filip722/submit/got-20261023
fix(relinker): preserve wrapped EIP-relative GOT accesses
2026-10-24 22:10:34 +13:00
Dean 538d97052e Merge pull request #10339 from Filip722/submit/rex-20261023
fix(relinker): honor the final REX prefix in call-site loads
2026-10-24 22:10:08 +13:00
Karim Masmoudi ce6c2a0c66 fix(relinker): rewrite XSAVEOPT to XSAVE under --to-rosetta
XSAVEOPT raises an illegal instruction under Rosetta on an M5 running
macOS 27.0.1, as XSAVEC does, while XSAVE and XRSTOR save and restore
x87, SSE and AVX state in the standard format. The PS5's Zen 2 has
XSAVEOPT, so code built for it can use the instruction without a CPUID
check.

XSAVEOPT differs from XSAVE only in the init and modified optimizations:
it may skip writing state that is in its initial configuration or
unchanged since the last XRSTOR from the same area. XRSTOR restores the
same state from the area XSAVE writes, so --to-rosetta rewrites
XSAVEOPT (NP 0F AE /6, memory operand) to XSAVE (/4) in place, keeping
the prefixes and the operand, as RDSEED becomes RDRAND. CLWB (66 0F AE
/6), MFENCE, UMONITOR, UMWAIT and the Intel target are left alone.
XSAVEC is not converted: it writes the compacted format.

The converter tests check the rewrite for the plain, REX.W,
RSP-relative, extended-base, RIP-relative and FS-relative forms, check
that the neighbouring 0F AE encodings are not taken, and execute the
rewritten XSAVEOPT64 followed by XRSTOR on YMM3 in the x86-64 build.
The --to-rosetta integration test now covers XSAVEOPT as well.
2026-10-24 11:01:44 +02:00
Adrià FranchandClaude Sonnet 5.5 e1fea2ebc8 fix(relinker): drop stray blank line and document the moving-branch guard
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-24 10:58:12 +02:00
Yaash Singhh f5fbf2f98d fix(relinker): rebase truncated branch guard onto current main 2026-10-24 10:58:00 +02:00