Repository navigation
fix(libSceSystemService): find a converted executable by the main executable's extension - #18857
Conversation
…cutable's extension The relinker names an executable converted with --executable after its guest path and the main output's extension. sceSystemServiceLoadExec looked for it with the extension of the executable that calls it. From a secondary executable beside an extensionless main output, such as the usual macOS output, the lookup added the secondary's own suffix and failed: Black Ops II stopped when its Zombies executable started the Multiplayer one. The lookup now takes the extension of the main executable that the first LoadExec records in APS5_EBOOT, and falls back to the calling executable when the variable is unset.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Red before green, run on the same macOS tree: with the new test and without the |
|
Windows check of head The merge configures cleanly. This PR's test target, AI-assisted: yes. |
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against b3b8daed41:
- Conventions:
tools/check_conventions.pypassed;git diff --checkclean. - Build:
guest_system_load_exec_secondary_testsbuilt cleanly. - CTest (
guest_system_load_exec_secondary):1/1 Test #4120: guest_system_load_exec_secondary ... Passed 0.13 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceSystemService/Export.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #4120: guest_system_load_exec_secondary ...Subprocess aborted***Exception: 1.15 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- core/libs/prx/libSceSystemService/Export.cpp: Verified PrepareLaunch reads APS5_EBOOT on Windows (GetEnvironmentVariableW) and POSIX (std::getenv), properly falling back to ownPath/own when unset or empty, and avoiding buffer overruns when recordedLength >= recorded.size().
- core/libs/prx/libSceSystemService/Export.cpp: Verified that converted secondary executable lookup resolves via main.extension() rather than own.extension(), correctly appending .exe, .elf, or an empty string to HostExecutable::ConvertedName without duplicate extension defects.
- core/libs/prx/libSceSystemService/Export.cpp: Verified the MainExecutable (/app0/eboot.bin) branch preserves existing launch semantics, correctly targeting the recorded main executable when invoked from a secondary executable.
- core/libs/tests/GuestSystemServiceLoadExecSecondary.cpp: Verified test logic covers both extensionless and .elf-suffixed main binary layouts using hard links, sets APS5_EBOOT to main, and confirms sceSystemServiceLoadExec successfully transfers control to the third executable.
- core/libs/prx/libSceSystemService/CMakeLists.txt: Verified guest_system_load_exec_secondary is registered under if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR APPLE) with correct include directories, link libraries (libSceSystemService, libkernel, libc), and a 20-second timeout.
- AGENTS.md compliance: Verified zero comments in code across all modified and newly added files (Export.cpp, CMakeLists.txt, GuestSystemServiceLoadExecSecondary.cpp), no title-specific hardcoding, and adherence to Conventional Commits in the PR title.
- Note: the AI-assisted checkbox can stay.
Looks Good To Me
What
The relinker names an executable converted with
--executableafter its guest path and the extension of the main output.sceSystemServiceLoadExeclooked for it with the extension of the executable that calls it. From a secondary executable that sits beside an extensionless main output (the usual macOS output), the lookup added the secondary's own suffix and failed: Black Ops II stopped when its Zombies executable started the Multiplayer one.The lookup now takes the extension of the main executable that the first
LoadExecrecords inAPS5_EBOOT, and falls back to the calling executable when the variable is unset. The same applies to the Windows path of the function.guest_system_load_exec_secondarystarts a third executable from a secondary one, beside a main executable with an extension (.elf) and beside one without, each time through hard links of the test executable and a recordedAPS5_EBOOT.Tested
macOS 27.0.1, Apple M3 Max (36 GB), Release build with
-DBUILD_TESTING=ON, x86_64 under Rosetta 2.maindoes not run its libraries on macOS, so both sides aremain3b7f31fa7with the macOS port (the squash of #8658, which its author upstreams in parts) and local macOS build fixes for tests ofmainthat Apple clang refuses; the change side adds this PR's commit.guest_system_load_exec_secondarypasses with the change.guest_systemorguest_lnc_util_load_execpass on both sides, and the new test is the 33rd on the change.python3 tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pyand a title search found no open pull request that changessceSystemServiceLoadExec.Not tested: Linux and Windows.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Context
Found while bringing up Call of Duty: Black Ops II (the Zombies executable starts the Multiplayer one).