Commit Graph
9 Commits
Author SHA1 Message Date
Adrià 2bf9fde0f0 Merge pull request #12554 from dkdhanda8/fix/entry-stub-rel32-wrap
fix(elfpatcher): reject an entry-stub rel32 distance that only fits after a 64-bit wrap
2026-10-30 10:51:50 +01:00
akkadbakkad89andDevin 0f14dddf61 fix(relinker): resolve kernel-family exports for libkernel-declared imports
Windows import resolution only searched the module an import declared,
plus a one-way libkernel_sys/libkernel_web to libkernel.prx fallback.
Modules declaring libkernel.prx for exports AnyPS5 implements in
libkernel_sys.prx or libkernel_web.prx failed to bind at startup; Linux
resolves them through the dynamic linker's global scope. GTA V's
bundled libSceAmpr is such a case. Needed-library augmentation and the
per-import search order now cover the whole kernel family in every
direction.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-29 10:04:28 +05:30
dkdhanda8 62e201bd8f fix(elfpatcher): reject an entry-stub rel32 distance that only fits after a 64-bit wrap
BuildEntryStub subtracted the call's next instruction address from the
real entry point in uint64 and range-checked the signed result, so an
entry point more than 2^63 from the stub wrapped into a small in-range
displacement and was written verbatim. The check now goes through
SignedDistance, which classifies both addresses by the 2^63 boundary
and rejects a magnitude int64 cannot hold. The new entry_stub test
places the stub at 0x1000 and the entry near 2^64: main wrote a
wrapped rel32, the change throws.
2026-10-29 00:55:33 +05:30
bluandClaude Opus 5.5 a946c469d6 Merge upstream main into feat/libc-num-get-objects
Resolves the conflict with #8867 in EntryStubTests.cpp: keep its two
kernel-variant tests and the BufferUtils include, and this branch's
libSceAmpr-to-libc fallback test, with all three called from main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 12:33:11 -07:00
MarcZX10 0d0b29cf44 test(relinker): require libc for kernel variant fallback 2026-10-21 05:47:05 +00:00
MarcZX10 7157ebb4e8 test(relinker): cover libc fallback for Ampr imports
(cherry picked from commit babde2b5bd9ea9af9fec545fcff33f00d1583fd6)
2026-10-20 21:30:07 -07:00
MarcZX10 fef2755c76 test(relinker): cover scoped kernel variant imports 2026-10-21 03:42:04 +00:00
Mehran 9824c46fe0 feat(libs): let relinked Windows games opt into mimalloc 2026-10-19 00:08:47 +03:00
john.maiaandClaude Opus 5.5 e4dcf3e6c0 fix(relinker): end the guest frame-pointer chain at the entry stub
The entry stubs called the title's entry with rbp left as the process
started it (0 on Linux) or as a loop counter left it (0 on Windows). The
title's start code pushes rbp, so the frame-pointer chain of its main
thread ended in a null frame pointer. Unreal Engine walks that chain to
capture call stacks (for an ensure, for example) and reads the return
address at [rbp + 8], so the walk read address 8 and crashed.

Both stubs now push a zero frame record (saved rbp 0, return address 0)
and point rbp at it before the call, so frame-pointer walks stop at the
entry. The Linux stub pushes it below the aligned stack pointer, keeping
the 16-byte alignment at the call. The Windows stub writes it into free
slots of its own frame at rsp+0x40.

PPSA15657 crashed in its stack walk at the title screen in about half of
its runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0134RWCyiyydJBbfKz8g9Bwe
2026-10-09 23:42:31 +01:00