Commit Graph
72 Commits
Author SHA1 Message Date
MarcZX10 0d0b29cf44 test(relinker): require libc for kernel variant fallback 2026-10-21 05:47:05 +00:00
MarcZX10 fef2755c76 test(relinker): cover scoped kernel variant imports 2026-10-21 03:42:04 +00:00
Dean 892a4f1328 Merge pull request #7993 from MarrasFederico/fix/relinker-windows-trampoline-builder-guards
fix(relinker): validate Windows trampoline section placement and sites
2026-10-21 06:30:55 +13:00
tkcm01 4d07bc0231 fix(relinker): format invalid Windows icon paths as UTF-8 2026-10-20 12:10:00 -04:00
JJenkxandClaude Opus 5.5 92ea0b9ce3 test(relinker): wait for the exited diagnostic runner to release its fixtures
windows_dependency_diagnostics rewrites the fixture images right after the
diagnostic runner exits. The runner ends with an unhandled RaiseException of
STATUS_DLL_NOT_FOUND, and Windows fault handling keeps the exited process's
image files open for a short time after its handle is signaled: on Windows 11
22621 the Restart Manager names the exited runner as the holder and the file
opens 37 to 153 ms later. The rewrite then fails with ERROR_SHARING_VIOLATION,
and the final removal of the fixtures with access denied. Retry opening a
fixture while it fails with a sharing violation and the removal while it fails
with access denied, for at most 10 s each; every other failure still fails the
test at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 21:45:35 -04:00
Adrià 7e12b3da80 Merge pull request #7736 from jotitadev/fix/relinker-desktop-entry-test-unique-dir
test(relinker): give the desktop entry test its own temporary directory
2026-10-20 03:13:23 +02:00
Adrià 48790e0233 Merge pull request #7039 from nabil88/fix/windows-libkernel-and-tests
feat(libkernel): implement getdtablesize and fix Windows host-tree removal
2026-10-19 19:36:18 +02:00
Federico Marras b336f0c4dc fix(relinker): validate Windows trampoline section placement and sites 2026-10-19 18:57:12 +02:00
Dean 00d7e611ef Merge pull request #7363 from plokmklo/fix/relinker-gnu-stack-relro
fix(relinker): synthesise a non-executable PT_GNU_STACK for Linux executables
2026-10-20 03:52:18 +13:00
Dean 98024d4bce Merge pull request #7772 from fogydes/fix/relinker-section-header-table-overlap-and-bounds
fix(relinker): validate section header table bounds and reject overlapping sections
2026-10-20 02:23:11 +13:00
Dean 111f9eb6f2 Merge pull request #7771 from fogydes/fix/relinker-program-header-layout-extra-block-overlap
fix(relinker): reject program header table overlapping the extra block
2026-10-20 02:22:57 +13:00
Dean 1fad170b8b Merge pull request #7770 from fogydes/fix/relinker-windows-icon-resource-rva-and-overlap-guards
fix(relinker): validate resource section RVA and prevent section overlaps
2026-10-20 02:22:43 +13:00
UAQ Taxi 379dca5cac test: raise the slow-host timeouts 2026-10-19 14:49:36 +02:00
Adrià 4630318457 Merge pull request #6681 from milescoviello/fix/relinker-bss-page-overlap
fix(relinker): keep a segment's zero-filled tail zero when the next PT_LOAD starts on its page
2026-10-19 10:48:54 +02:00
plokmklo c1866af79b fix(relinker): synthesize PT_GNU_STACK for Linux outputs without one
Outputs whose input carries no PT_GNU_STACK get one appended with
PF_R|PF_W and alignment 16 so the kernel does not fall back to an
executable stack marking.

RequiredProgramHeaderCount and WriteLayout now derive from one shared
header list, so the reserved slot and the written header cannot
disagree at any PhNum boundary, when a free input slot should be
reused, or when the RELRO coverage guard reduces the kept count.
Space exhaustion beyond the 16-bit header limit fails loudly instead
of silently skipping the header.
2026-10-19 07:30:56 +00:00
fogydes 5536aa8c0d fix(relinker): validate section header table bounds and reject overlapping sections 2026-10-19 12:22:43 +05:30
fogydes 93d3f89b51 fix(relinker): reject program header table overlapping the extra block 2026-10-19 12:21:35 +05:30
fogydes a7374e243e fix(relinker): validate resource section RVA and prevent section overlaps 2026-10-19 12:19:59 +05:30
Jota 21325fba43 test(relinker): give the desktop entry test its own temporary directory 2026-10-19 04:51:37 +00:00
Mehran 9824c46fe0 feat(libs): let relinked Windows games opt into mimalloc 2026-10-19 00:08:47 +03:00
milescovielloandClaude Opus 5.5 24ec391c06 fix(relinker): keep a segment's zero-filled tail zero when the next PT_LOAD starts on its page
On Linux the kernel maps each PT_LOAD from the start of its first page.
When a segment begins inside the page that holds the end of the previous
segment's zero-filled memory, that page is mapped again from the file, and
the bss tail reads whatever bytes precede the segment in the file. Nuvio
Max'd 0.5.27 (PPSA99288) keeps a mutex there and crashes at launch.

A segment whose page would read wrong bytes is now appended to the output
with that page prefix rebuilt from the segments below it. Outputs whose
pages already read right are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 18:41:25 +00:00
Adrià 8c90c879e0 Merge pull request #5990 from Get-fix/ps4/windows-libc-for-libkernel
fix(relinker): search libc.prx for libkernel-only Windows executables
2026-10-17 01:16:00 +02:00
Adrià 383cb26339 Merge pull request #5614 from JJenkx/fix/linux-guest-finalizer-arguments
fix(relinker): clear Linux guest finalizer arguments
2026-10-16 21:23:12 +02:00
Get-fix 8c34587598 fix(relinker): search libc.prx for libkernel-only Windows executables
AnyPS5 exports some libkernel functions, such as __error, from
libc.prx, which libkernel.prx links. On Linux they resolve through that
dependency. On Windows, the import stubs search only the listed
modules, and libc.prx was listed only when libSceLibcInternal.prx was
needed. A PS4 homebrew that needs libkernel.prx but no C library (the
OpenOrbis graphics sample) failed with "unresolved ELF import
9BcDykPmo1I". libc.prx is now also listed when libkernel.prx is needed.
PS5 executables need libSceLibcInternal.prx and convert unchanged.
2026-10-15 21:02:31 +03:00
Adrià f50d4335ab Merge pull request #5587 from nikowolf123/fix/relinker-dependency-diagnostics
fix(relinker): name missing and non-PE modules in Windows dependency diagnostics
2026-10-15 13:39:17 +02:00
Adrià 341613ab62 Merge pull request #5543 from mariuszkreft/fix/gpu-extra-load-drops-guest-tail
fix(relinker): place the Linux extra PT_LOAD past the last guest page
2026-10-15 13:31:07 +02:00
m2 (AI Agent) 7f73643e0c test(relinker): name each program-layout check instead of tracking its line 2026-10-15 03:50:14 +02:00
Ondra97 46b96329e3 fix(relinker): reject invalid PNG icon chunk types 2026-10-14 07:53:01 +02:00
NikoandClaude Opus 5.5 4ba4ede2a9 fix(relinker): name missing and non-PE modules in Windows dependency diagnostics
When a relinked executable fails to load a staged module, the dependency
diagnostics routine maps the same path as an image resource to walk its
imports. If that mapping failed it printed only "FAIL: dependency
diagnostics Windows API failed". The log then did not say whether the
staged module itself (libs\libSceRegMgr.prx in #4720) was absent or was
not a Windows image, and a module reached through another module's
imports was not named at all.

The register routine now reads GetLastError when LoadLibraryExW fails.
ERROR_FILE_NOT_FOUND and ERROR_PATH_NOT_FOUND print "dependency module
not found", ERROR_BAD_EXE_FORMAT prints "dependency module is not a
Windows PE image"; both name the module path, its importer and the
chain from the executable, like the existing missing-module report.
Other errors keep the generic message. An API set contract that
LoadLibraryExA reports as ERROR_MOD_NOT_FOUND now gets the
missing-module report too.

Refs #4720

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 01:51:23 +02:00
mariuszkreft 58120ca418 fix(relinker): place the Linux extra PT_LOAD past the last guest page
ComputeExtraBlockVaddr kept the ELF congruence p_vaddr == p_offset (mod 0x1000)
and bumped the result by one page only when it fell below the highest guest
load end as a byte address. When that end is not page aligned and the extra
block's file offset remainder reaches it, the extra RWX PT_LOAD landed in the
same 4 KiB page that holds the tail of the highest guest segment. The kernel
maps each PT_LOAD page by page with MAP_FIXED in program-header order, so the
extra block's file page replaced the guest's .data tail and zero-filled .bss
there.

Round the highest kept PT_LOAD end up to the page before adding the offset
remainder, which is the placement GuestModuleWriter::WriteLinux already uses
for the guest module. Only the overlapping case changes; an end that is page
aligned or a remainder below it yields the same address as before.

The extra PT_LOAD now also spans to the end of its own page in p_memsz, so the
page it takes over is fully covered, and its vaddr is derived in WriteLayout
instead of being taken from the request. The header block load carries the
same flags as before.
2026-10-14 01:17:49 +02:00
JJenkx 57a97f61c5 Merge commit '30f961266ade83b41d5c9de7dec1393e7fcecfb7' into fix/linux-guest-finalizer-arguments 2026-10-13 18:59:58 -04:00
Adrià 34cee1ef15 Merge pull request #4608 from MiniRML/fix/relinker-icon-png-chunks
fix(relinker): validate icon PNG critical chunks and order
2026-10-13 17:50:39 +02:00
Adrià 27477e5f47 Merge pull request #4583 from MiniRML/fix/relinker-section-name-address
fix(relinker): zero the unmapped section-name table address
2026-10-13 17:49:15 +02:00
MiniRML bfffd3359c fix(relinker): validate icon PNG critical chunks and order 2026-10-13 16:38:28 +02:00
Adrià a2a3a3a94d Merge pull request #4062 from danzaio/fix/windows-log-without-standard-handles
fix(relinker): log Windows output when standard handles are missing
2026-10-13 14:11:42 +02:00
boykopovar 3e658db4b6 refactor(relinker): remove the obsolete file-based icon builder 2026-10-13 12:57:55 +03:00
JJenkx e306204c58 fix(relinker): clear Linux guest finalizer arguments 2026-10-12 12:42:22 -04:00
MiniRML a6f42f5119 fix(relinker): zero the unmapped section-name table address 2026-10-12 09:10:47 -07:00
danzaio ae96779914 test(relinker): verify Windows DLL CRT output handles 2026-10-12 00:15:49 -03:00
Dean 2263cefe25 Merge pull request #3601 from Scramblrrrr/codex/legacy-sse-reciprocals
fix(relinker): lower legacy packed reciprocal register instructions
2026-10-12 15:43:20 +13:00
Adrià bb48d60fc6 Merge pull request #3774 from MrMha/fix/program-layout-ranges
fix(relinker): validate program layout ranges before writing
2026-10-12 00:00:46 +02:00
MrMha 3742fa136e test(relinker): cover extra block bounds and header address overflow 2026-10-11 23:11:42 +04:00
MrMha 653eb704c2 fix(relinker): validate complete allocated section ranges 2026-10-11 19:52:18 +04:00
MrMha d85d1c268f fix(relinker): validate program layout ranges before writing 2026-10-11 19:51:17 +04:00
Scramblrrrr 363d17985e fix(relinker): lower legacy packed reciprocal register instructions 2026-10-11 10:58:14 -03:00
Adrià FranchandClaude ca330dfefb fix(relinker): validate the desktop entry before writing the executable
The icon, title and output path are checked before the ELF is written,
so a malformed icon0.png or param.json leaves no output behind. Paths
with control characters are refused instead of producing an invalid
entry.

Co-Authored-By: Claude <[email protected]>
2026-10-11 12:39:14 +02:00
Adrià FranchandClaude 1ff7b534fe feat(relinker): write a desktop entry with the game icon for Linux executables
ELF has no icon resource, so when sce_sys/icon0.png sits beside the input
the relinker copies it next to the output and writes <output>.desktop
(freedesktop Desktop Entry) with that icon. Name is the param.json title
without trademark signs or line breaks, or the output name without
param.json. Exec is quoted per the spec and the entry is marked executable
so file managers launch it. A malformed icon0.png or param.json fails the
relink; without icon0.png nothing extra is written.

Co-Authored-By: Claude <[email protected]>
2026-10-11 12:39:14 +02:00
Doston AbdullayevandClaude Opus 5.5 28b1f1578f fix(relinker): walk Windows dependency diagnostics through the wide API
The --windows-diagnostics walker looked up modules and directories with
GetModuleHandleA, LoadLibraryExA, GetFileAttributesA,
GetModuleFileNameA and GetSystemDirectoryA, so under a directory outside
the ANSI code page it failed with "dependency diagnostics Windows API
failed" instead of naming the missing dependency.

Keep the walker's paths in UTF-8 and convert them at the Windows API
calls, which now use the wide functions. The entry stub passes it, and
prints, its paths as UTF-8 instead of the ANSI code page. The dependency
diagnostics test now builds its fixtures under a non-ASCII directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-10 19:42:28 +00:00
Hannah Lyons 0e03ad0f95 fix(relinker): skip repeated DT_NEEDED libraries 2026-10-10 21:23:19 +13:00
Adrià 019ca236fb Merge pull request #1958 from arcwiser/fix/windows-pe-relocs-stripped
fix(relinker): keep Windows images without relocations loadable
2026-10-10 08:06:20 +02:00