Commit Graph
1478 Commits
Author SHA1 Message Date
Dean 8b9ae2fa8c Merge pull request #11626 from Mherberts/codex/fix-segment-prefixed-import-sites
fix(relinker): recognize ignored segment prefixes in import sites
2026-11-03 01:26:05 +13:00
Dean 02818f42e9 Merge pull request #11583 from roboterspinne/fix/relinker-windows-lazy-data-imports
fix(relinker): bind unresolved Windows data imports eagerly under --lazy-binding
2026-11-03 01:25:43 +13:00
Dean 718204e587 Merge pull request #11487 from roboterspinne/fix/relinker-linux-congruent-loads
fix(relinker): move a Linux PT_LOAD whose file offset is not page-congruent with its address
2026-11-02 23:28:40 +13:00
Dean 3b6f3cbb4d Merge pull request #11479 from roboterspinne/fix/relinker-ambiguous-needed-module
fix(relinker): reject a needed module name that several bundled modules match only by extension
2026-11-02 23:28:33 +13:00
Dean da0f097c78 Merge pull request #11107 from AdnanKhan-ak47/feat/relinker-lower-bzhi-bextr
feat(relinker): lower BZHI and BEXTR under --to-rosetta
2026-11-02 23:26:58 +13:00
Dean 36564b6b4f Merge pull request #10970 from AdnanKhan-ak47/feat/relinker-lower-bls
feat(relinker): lower BLSI, BLSMSK and BLSR under --to-rosetta
2026-11-02 23:26:20 +13:00
Dean 2a9de0ea82 Merge pull request #10495 from wail-arch/fix/linux-guest-zero-address-exports
fix(relinker): bind guest function exports at address 0 on Linux
2026-11-02 23:22:55 +13:00
Dean 6ca4efb422 Merge pull request #9793 from Iluminatti312/fix/relinker-windows-extended-path-argv
fix(relinker): preserve Windows extended-path arguments
2026-11-02 20:58:41 +13:00
Dean 8d16af3c57 Merge pull request #11137 from kaiffeetasse/contrib/8624-sdk-syscall6-inline-stub
fix(relinker): trap the inlined SDK __syscall6 stubs
2026-11-02 10:49:26 +13:00
Adrià e53aff3f56 Merge pull request #13921 from dr-hoseyn/feat/relinker-option-terminator
feat(relinker): support the end-of-options separator
2026-11-01 12:30:22 +01:00
Adrià e67cc81869 Merge pull request #13926 from dr-hoseyn/feat/relinker-dry-run
feat(relinker): validate conversions without writing outputs
2026-11-01 11:50:43 +01:00
Dean Galvin eba0bc998a Merge commit 'a644edf30c501a612d06f17d05ef1b7051350cef' into HEAD
# Conflicts:
#	core/relinker/main.cpp
2026-11-01 23:13:39 +13:00
Adrià 1f2c1da1fb Merge pull request #13916 from roboterspinne/fix/relinker-relr-code-roots
fix(relinker): follow DT_RELR pointers as code roots in code analysis
2026-11-01 09:40:48 +01:00
Adrià 6a1d537332 Merge pull request #13915 from roboterspinne/fix/relinker-guest-tls-relocations-empty-pt-tls
fix(relinker): require a non-empty PT_TLS for guest module TLS relocations
2026-11-01 09:40:41 +01:00
Adrià ad9c554112 Merge pull request #13914 from roboterspinne/fix/relinker-reject-duplicate-eh-frame-header
fix(relinker): reject a second PT_GNU_EH_FRAME segment
2026-11-01 09:40:25 +01:00
roboterspinne 94e4031147 fix(relinker): keep a moved Linux PT_LOAD's alignment on the header block
Moving a PT_LOAD to the end of the file sets its p_align to
min(p_align, 0x1000), since the copy honours only the page. When that
segment carried the largest p_align, the output's largest PT_LOAD
alignment, which Linux uses to align the ET_DYN load bias, fell with
it. SeparateSharedLoadPages now returns the largest power-of-two
p_align above the page that it lowered, and WriteLayout aligns the
header block PT_LOAD to at least that value, as it already does for
the largest kept p_align.
2026-11-01 09:37:04 +01:00
Dean ca79739814 Merge pull request #12649 from slopgobblercobbler/fix/strict-nid-filter-negative-relative-relocation-target
fix(relinker): reject negative relative relocation targets in strict filter
2026-11-01 19:49:22 +13:00
Dean 81a8878274 Merge pull request #14151 from p3n1cillin/claude/relinker-relative-rewrite
fix(relinker): let a later RELATIVE entry replace an earlier one in a guest module
2026-11-01 19:28:59 +13:00
Adrià 0a148be963 Merge pull request #13818 from Ninot1Quyi/fix/relinker-empty-load-segments
fix(relinker): ignore empty guest load ranges in overlap checks
2026-11-01 03:02:31 +01:00
Adrià 1ad51ae5ed Merge pull request #13825 from JJenkx/windows/relinker-cfg-reached-map
perf(relinker): mark reached code in a map while collecting instructions
2026-11-01 02:54:04 +01:00
Adrià 1e80cf96b3 Merge pull request #13775 from dr-hoseyn/fix/find-c-bug
fix(web): convert modules from all standard directories
2026-11-01 01:25:09 +01:00
Kai Laue f2d7e367a7 fix(relinker): pin the __syscall6 syscall numbers instead of masking them
Review feedback: the three mount-family patterns now carry their exact numbers (21, 378, 22) like the mman patterns, so a stub with another number is not matched. The fixture check that changed only the masked bytes could not fail for the unmount fixture, whose number is also 22; it now rewrites the number field to 0, 1, 21, 22 and 378 and requires every other number to be rejected. Technical debt says the numbers are pinned.
2026-11-01 01:17:20 +01:00
Kai Laue 537c76fc9b fix(relinker): trap the inlined SDK __syscall6 stubs
Recognize the inlined __syscall6 wrappers of ps5-payload-dev SDK libc/mount.c (mount, nmount, unmount) under --trap-sdk-syscall-stubs, with the four-byte syscall number immediate masked so an SDK build that renumbers the call still matches. The three wrappers differ in argument preparation, so each sequence is matched separately.

Observed in ftpsrv v0.21.1 (0x709a, 0x70ec, 0x713c) and websrv v0.35 (0xae6a, 0xaebc, 0xaf0c). Related: issue #8624, open draft PR #8729 covers mount only.
2026-11-01 01:17:20 +01:00
Adrià 693f9d09ca Merge pull request #13693 from PROGABBOMALA/fix/relinker-code-data-boundaries-7547
fix(relinker): resolve code and data boundaries in syscall scanner (#…
2026-11-01 00:54:43 +01:00
Adrià 3cd86850c6 Merge pull request #13563 from rooklz/test/unwind-sdata2-funcrel-signed-overflow
test(relinker): pin EH sdata2 funcrel signed pointer overflow
2026-10-31 22:39:41 +01:00
PROGABBOMALA 6a82825008 fix(relinker): restrict lea roots to unwind reachability (#7547) 2026-10-31 22:35:11 +01:00
Dean c48c5da86e Merge pull request #7037 from namanipie/fix/relinker-overflowing-file-offsets
fix(relinker): reject overflowing ELF file offsets
2026-11-01 10:32:46 +13:00
p3nicillinandClaude Opus 5.5 00e763b949 fix(relinker): let a later RELATIVE entry replace an earlier one in a guest module
RELA entries are applied in order, and an R_X86_64_RELATIVE entry writes
relocbase + addend to its target (FreeBSD rtld's reloc_non_plt). Two
symbol-less RELATIVE entries for one target therefore leave the later
addend in place. Guest-module parsing and code analysis refused the pair
as overlapping; now the later entry replaces the earlier one.

PS5MC's sce_module/libc.prx (PPSA99420), the loader companion its build
generates, relocates 0x8058 twice: to 0x80e0, then to 0x82a0. It could
not be converted. Any other overlap, including a RELATIVE entry over a
symbol relocation, is still refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 21:01:42 +00:00
rooklz 9a4588752c test(relinker): pin EH sdata2 funcrel signed pointer overflow 2026-10-31 21:56:34 +01:00
PROGABBOMALA b8fc47fd47 fix(relinker): recognize indirect lea roots and restore gap data skip (#7547) 2026-10-31 21:29:39 +01:00
rooklz 025435d164 fix(relinker): reject udata8 funcrel unwind pointer overflow 2026-10-31 19:07:45 +01:00
rooklz fd065eece1 test(relinker): pin EH udata2 funcrel overflow via LSDA path 2026-10-31 18:07:47 +01:00
rooklz d2de599520 test(relinker): pin EH udata2 funcrel table overflow 2026-10-31 18:07:41 +01:00
dr-hoseyn b2343e91ec feat(relinker): add conversion dry runs 2026-10-31 16:29:20 +03:30
dr-hoseyn eaf497d239 feat(relinker): support the end-of-options separator 2026-10-31 16:10:56 +03:30
PROGABBOMALA 0218b3529d fix(relinker): reject dynamic syscalls in indirect routines with unwind ranges (#7547) 2026-10-31 13:33:05 +01:00
rooklz ffa4075be8 test(relinker): pin EH udata4 funcrel overflow via LSDA path 2026-10-31 13:27:20 +01:00
roboterspinne 015778c83e fix(relinker): also require a non-empty PT_TLS for guest relocations against defined TLS symbols
A DTPMOD64, DTPOFF64 or TPOFF64 against an STT_TLS symbol defined in the
module itself names the module's own TLS block as much as symbol 0
does, and #10730 rejects both forms for executables. Fail them as well
when the module's PT_TLS has p_memsz 0.
2026-10-31 12:55:09 +01:00
roboterspinne 3d5a51c470 test(relinker): convert the duplicate EH frame fixtures on every target before the new check 2026-10-31 12:52:58 +01:00
AdriàandClaude Haiku 5.5 0dba616a91 test(relinker): pin EH uleb128 datarel overflowing LEB128 row
Standalone eh_frame_hdr row after the existing table overflow case:
encoding 0x31 (uleb128 | datarel) with a ten-byte ULEB128 whose last
byte overflows 64 bits, on segments at 0xFFFFFFFFFFFFF000. The reader
must throw "overflowing LEB128 value" from EhFrameReader::leb.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
2026-10-31 12:48:54 +01:00
roboterspinne 771dedd5e5 refactor(relinker): record RELR code pointer slots without an unreachable conflict check 2026-10-31 12:44:57 +01:00
roboterspinne 35035980f0 fix(relinker): follow DT_RELR pointers as code roots in code analysis
CodeInstructionCollector took code pointers from DT_RELA and DT_JMPREL
but not from DT_RELR, which the pipeline has applied since #11463. A
function reachable only through a RELR pointer was therefore no entry
root, and a Windows TLS rewrite or GS trap could overwrite it without
the "would overwrite an executable entry point" refusal that the same
pointer as a RELA R_X86_64_RELATIVE triggers. Read the RELR table with
ReadRelrRelocations and record its slots like relative relocations.
2026-10-31 12:22:32 +01:00
Adrià 467673ea69 Merge pull request #13591 from rooklz/test/unwind-uleb128-funcrel-signed-overflow
test(relinker): pin EH table uleb128 funcrel overflow row
2026-10-31 12:21:15 +01:00
roboterspinne 94c6552030 fix(relinker): require a non-empty PT_TLS for guest module TLS relocations
The guest image reader accepted a module's TLS relocations against its
own block, by symbol 0 or by an unnamed zero-value section symbol,
whenever a PT_TLS header existed, also one with p_memsz 0. Linux output
kept such relocations, while Windows and macOS output rejected only
some of them later with different messages. Require a PT_TLS with a
nonzero p_memsz, as #10730 did for executables, so every target fails
these modules with "Invalid guest TLS relocation".
2026-10-31 12:07:09 +01:00
roboterspinne 54f981f596 fix(relinker): reject a second PT_GNU_EH_FRAME segment
An executable or guest module with two PT_GNU_EH_FRAME headers converted
on every target: Linux output kept both headers and Windows output wrote
one .ehmeta section per header, while the unwinders at run time use a
single table per object. Reject the second header like a second
PT_DYNAMIC, in the pipeline for the executable and in the guest image
reader for modules.
2026-10-31 11:59:23 +01:00
Adrià cf5a1805e5 Merge pull request #13520 from rooklz/test/unwind-sdata2-datarel-signed-overflow
test(relinker): pin EH sdata2 datarel signed overflow
2026-10-31 11:20:19 +01:00
rooklz 7aee2b951d test: repair uleb128 funcrel overflow via LSDA path
Replace flawed EH-table case 11 with a standalone CIE zPLR fixture
(LsdaEncoding 0x41) that trips overflowing LEB128 in readFde.
2026-10-31 11:19:33 +01:00
Adrià 049619c202 Merge pull request #13580 from rooklz/test/unwind-sleb128-funcrel-signed-overflow
test(relinker): pin EH sleb128 funcrel signed overflow
2026-10-31 11:12:13 +01:00
JJenkxandClaude Opus 5.5 3f20e4b42d fix(relinker): publish the reached addresses without an allocating destructor
The set-based control-flow walk inserted the addresses it found into the
caller's set from a destructor. Destructors are noexcept, so a failed
allocation there called std::terminate instead of reaching the
conversion's error handling as std::bad_alloc. The addresses are now
inserted after the walk returns, and before an exception from the walk
is rethrown, as the walk did before.

The new test arms a failing operator new from the progress callback
during a walk of 8,192 instructions and requires std::bad_alloc to reach
the caller; with the destructor it terminated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 05:29:06 -04:00
Adrià c3c45d73ab Merge pull request #13620 from PolkadotDom/fix/cfg-segment-relative-transfers
fix(relinker): keep segment-relative transfers unresolved in CFG
2026-10-31 10:28:55 +01:00