Commit Graph
1440 Commits
Author SHA1 Message Date
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
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
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
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
rooklz 95b392894c test(relinker): pin EH sdata2 datarel signed overflow 2026-10-31 10:20:08 +01:00
rooklz 4313a46db1 test(relinker): pin sleb128 funcrel overflow via LSDA path 2026-10-31 10:16:48 +01:00
rooklz fd154cb422 test(relinker): pin EH sleb128 funcrel signed overflow 2026-10-31 10:16:33 +01:00
JJenkxandClaude Opus 5.5 2250da786c perf(relinker): mark reached code in a map while collecting instructions
The control-flow walk kept the reachable instructions of a code segment
in a std::unordered_set: every decoded instruction looked itself up,
was inserted, and was inserted into and erased from a visited set. The
instruction collector also handed the same growing set to each pass of
its root loop and walked all of it again every time.

The walk now marks each text offset in a byte map: reached, queued or
not seen. Queued marks are cleared when a walk ends, as the per-call
visited set was. ExtendControlFlowGraph takes a caller's map and
returns only the addresses that one walk added, in address order. The
collector keeps one map per segment and handles just those addresses.
BuildControlFlowGraph with a reachable set fills the map from the set
and inserts the new addresses in the order they were found.

Converting Goat Simulator 3's (PPSA04158) eboot.elf with
relinker --windows takes 27.56 s instead of 45.26 s (median of six
alternating runs on a Ryzen 9 5950X). Four more titles' eboot.elf
convert 35-54% faster, and every run produces the same output files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 04:22:47 -04:00
rooklz 9473c87181 test(relinker): pin EH sdata8 funcrel signed pointer overflow 2026-10-31 09:10:43 +01:00
Qu Yi 134b6cf0be fix(relinker): ignore empty guest load ranges in overlap checks 2026-10-31 15:51:30 +08:00
AdriàandClaude Haiku 5.5 fe13b4d2df test(relinker): pin EH sdata4 funcrel signed overflow row
Standalone EH table fixture after the unwind record loop: CIE zPLR with
LSDA encoding 0x4B (sdata4 funcrel), FDE augmentation 0xFFFFEFFF with
functionBase at the FDE begin 0x1000. The signed branch of
EhFrameReader::encoded must reject it with "unwind pointer address
overflowed".

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
2026-10-31 08:15:42 +01:00
rooklz 30eafc1ee3 test(relinker): pin EH sdata8 datarel signed overflow 2026-10-31 07:09:55 +01:00
dr-hoseyn 876e99fbb6 fix(web): keep standard modules in startup dependencies 2026-10-31 09:03:05 +03:30
dr-hoseyn e2d531921f fix(web): convert modules from all standard directories 2026-10-31 09:03:05 +03:30
rooklz 0d9e410b1a test(relinker): pin EH sdata4 datarel signed overflow 2026-10-31 05:12:57 +01:00
AdriàandClaude Haiku 5.5 aa968f07de test(relinker): pin EH table udata4 datarel overflow
Standalone block after the main table overflow case: encoding 0x33
(udata4 + datarel), u32 0xFFFFFFFF displacements at the real table
entry offsets 16 and 20, data base 0xFFFFFFFFFFFFF000 so max - base
is 0xFFF, and an assert on the overflow RelinkerException message.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
2026-10-31 03:41:07 +01:00
PROGABBOMALA 695e2ec3d5 fix(relinker): resolve code and data boundaries in syscall scanner (#7547) 2026-10-31 02:14:04 +01:00