You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
libkernel does not export system (Jc6E7N+dHz0). Yamagi Quake II (PPSA99007) stops on it at load on main, and ccleste (PPSA59322) imports it too.
In both titles the only caller is the bundled Mesa. A small function runs system("clrxdisasm --version > /dev/null 2>&1") and returns whether the result is 0, which tells Mesa whether the CLRX disassembler is installed. It sits on the shader-disassembly dump path, at 0x4608d0 in the PPSA99007 executable and 0x826270 in PPSA59322 (the single call [system] site in each).
system now follows FreeBSD 11's lib/libc/stdlib/system.c (source) for a process with no /bin/sh:
A null command returns 1. That version returns 1 without checking for the shell (if (!command) return(1);).
Any other command runs nothing and returns 0x7f00. In FreeBSD, the child that cannot execl(_PATH_BSHELL, ...) calls _exit(127), and system returns its wait status. So WIFEXITED is true and WEXITSTATUS is 127, and Mesa's probe sees that CLRX is not available.
The guest errno is not touched.
No host command is ever run. A new line in docs/dev/TechnicalDebt.md says what is assumed: that the console's application sandbox has no shell, and that vfork succeeds there (FreeBSD returns -1 when it fails).
Log
I don't have a console, and I couldn't run the titles here: the host is aarch64 and the project needs x86-64. The stop is from @SleglJan's run of the homebrew catalog on main4b6ab6b in #1578 (comment). Each title was relinked with --registry and run for 8 s on Linux. In the table of first stops, system is the stop for PPSA99007 Yamagi Quake II, with no open PR. That run reports the stop as app.elf: symbol lookup error: app.elf: undefined symbol: Jc6E7N+dHz0. Closed#3 also reported a Quake II build stopping at Jc6E7N+dHz0 (system) before guest entry.
PPSA59322: PS5_Celeste 1.00, PPSA59322.zip, sha256 96861b81…fb43. It stops earlier, on shm_open (separate PR).
The call sites come from the unwrapped eboot.bin of each release: the relocation for Jc6E7N+dHz0, then the only call qword ptr [rip+…] through that slot.
With this PR applied, @CouchRiv ran PPSA99007 on Linux (NVIDIA, mainf145139 plus this PR, 90 s timeout) (comment). On main it stops at load with undefined symbol: Jc6E7N+dHz0, exit 127. With the PR, system resolves and the next stop is mkstemp (uEtgPWgPxOk, claimed by #1613):
/work/runtime/app.elf: symbol lookup error: /work/runtime/app.elf: undefined symbol: uEtgPWgPxOk
The LD_BIND_NOW trace goes from 21 to 20 unresolved imports, with nothing new.
Tested
aarch64 Debian 13 host. The full project cannot be built here because it needs x86-64.
New core/libs/tests/GuestSystemCommand.cpp (guest_system_command) checks:
a null command returns 1
Mesa's probe string, exit 0 and an empty command each return a status with WIFEXITED true and exit status 127
errno is unchanged
It passes natively on aarch64 (Zig 0.17 clang, glibc 2.36), and on x86_64-linux-musl under qemu-user. Both builds link the export's body with a guest errno stand-in.
Negative check: without the change the test does not link. A mutant that returns 0 for a command aborts, and so does one that returns 0 for a null command.
Process.cpp and the test compile for x86_64-linux-gnu and x86_64-windows-gnu with -Wall -Wextra. The only warnings are the existing -Wreturn-type-c-linkage ones from General.hpp and Shutdown.hpp.
python3 tools/check_conventions.py --base origin/main passes. tools/progress.py: libkernel goes from 426 to 427 implemented.
Ran Yamagi Quake II 0.2.0-alpha.1 (PPSA99007, homebrew catalog release) on Linux with this PR merged onto mainf145139, in a sandbox, NVIDIA, 90 s timeout.
On main it stops at load, exit 127:
/work/runtime/app.elf: symbol lookup error: /work/runtime/app.elf: undefined symbol: Jc6E7N+dHz0
With this PR system resolves and the next stop is mkstemp (claimed by #1613), exit 127:
/work/runtime/app.elf: symbol lookup error: /work/runtime/app.elf: undefined symbol: uEtgPWgPxOk
The LD_BIND_NOW load trace goes from 21 to 20 unresolved imports, with nothing new.
@CouchRiv thanks, that's the run this PR was missing. I've added it to Log and Tested. The next stop, mkstemp, belongs to #1613, so I'm leaving it out of this one.
First Windows run, since the description says it wasn't tested on Windows.
Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Merged onto mainb7218b3 together with nine other small libc/libkernel PRs: #1975, #1976, #1977, #1685, #1676, #1675, #1641, #1656, #1807.
guest_system_command passes.
Full ctest: 510/510 (one GPU test skipped for a device limit).
Checked the system semantics against FreeBSD 11 lib/libc/stdlib/system.c (null → 1, otherwise the wait status of a child that couldn't exec the shell, 127 << 8), the guest errno being left alone, the test registration in ctest and the TechnicalDebt entry. guest_system_command passes locally on Linux and fails to link without the change; Linux and Windows CI are green. Also confirmed by @CouchRiv (PPSA99007 on Linux/NVIDIA gets past system) and @popcoder565 (Windows, MinGW); merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
libkerneldoes not exportsystem(Jc6E7N+dHz0). Yamagi Quake II (PPSA99007) stops on it at load onmain, and ccleste (PPSA59322) imports it too.In both titles the only caller is the bundled Mesa. A small function runs
system("clrxdisasm --version > /dev/null 2>&1")and returns whether the result is 0, which tells Mesa whether the CLRX disassembler is installed. It sits on the shader-disassembly dump path, at 0x4608d0 in the PPSA99007 executable and 0x826270 in PPSA59322 (the singlecall [system]site in each).systemnow follows FreeBSD 11'slib/libc/stdlib/system.c(source) for a process with no/bin/sh:if (!command) return(1);).0x7f00. In FreeBSD, the child that cannotexecl(_PATH_BSHELL, ...)calls_exit(127), andsystemreturns its wait status. SoWIFEXITEDis true andWEXITSTATUSis 127, and Mesa's probe sees that CLRX is not available.errnois not touched.No host command is ever run. A new line in
docs/dev/TechnicalDebt.mdsays what is assumed: that the console's application sandbox has no shell, and thatvforksucceeds there (FreeBSD returns -1 when it fails).Log
I don't have a console, and I couldn't run the titles here: the host is aarch64 and the project needs x86-64. The stop is from @SleglJan's run of the homebrew catalog on
main4b6ab6b in #1578 (comment). Each title was relinked with--registryand run for 8 s on Linux. In the table of first stops,systemis the stop for PPSA99007 Yamagi Quake II, with no open PR. That run reports the stop asapp.elf: symbol lookup error: app.elf: undefined symbol: Jc6E7N+dHz0. Closed #3 also reported a Quake II build stopping atJc6E7N+dHz0(system) before guest entry.PPSA99007.zip, sha2564fa5da07…9a70, matching the catalog recordPPSA59322.zip, sha25696861b81…fb43. It stops earlier, onshm_open(separate PR).The call sites come from the unwrapped
eboot.binof each release: the relocation forJc6E7N+dHz0, then the onlycall qword ptr [rip+…]through that slot.With this PR applied, @CouchRiv ran PPSA99007 on Linux (NVIDIA,
mainf145139 plus this PR, 90 s timeout) (comment). Onmainit stops at load withundefined symbol: Jc6E7N+dHz0, exit 127. With the PR,systemresolves and the next stop ismkstemp(uEtgPWgPxOk, claimed by #1613):The
LD_BIND_NOWtrace goes from 21 to 20 unresolved imports, with nothing new.Tested
aarch64 Debian 13 host. The full project cannot be built here because it needs x86-64.
core/libs/tests/GuestSystemCommand.cpp(guest_system_command) checks:exit 0and an empty command each return a status withWIFEXITEDtrue and exit status 127errnois unchangederrnostand-in.Process.cppand the test compile for x86_64-linux-gnu and x86_64-windows-gnu with-Wall -Wextra. The only warnings are the existing-Wreturn-type-c-linkageones fromGeneral.hppandShutdown.hpp.python3 tools/check_conventions.py --base origin/mainpasses.tools/progress.py: libkernel goes from 426 to 427 implemented.systemand stops next atmkstemp(feat(posix): implement mkstemp and isatty #1613). See Log.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)