feat(libkernel): export cpuset_getid, rfork_thread and sceKernelRdup #16270
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16270"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by NevesHenry on 2026-11-06T02:32:11Z.
What
ProsperoWeb (PRWB00001) 0.2.1, a web browser in the homebrew catalog, imports
cpuset_getid(DGY7qWLcHGA),rfork_thread(bSDxEpGzmUE) andsceKernelRdup(LxIacrWiJ3w) fromlibkernel. Onmainonlylibkernel_sysexports them, and nothing this title loads on Linux needslibkernel_sys.prx, so the dynamic loader stops before the entry point:tools/audit_dump.pylists these three as the title's only imports that another library exports, which "resolve on Linux"; that holds only when something else loadslibkernel_sys.prx. On Windows the kernel-family search from #12430 should find them. I didn't run it there. No other catalog title imports any of the three, orcpusetandcpuset_setid, fromlibkernel_sys(import audit of 139 catalog packages).Change:
Cpuset.cppmoves fromlibkernel_systolibkernel/System/srcunchanged except for its include.cpusetandcpuset_setidmove withcpuset_getidbecause the three share its set table. Their declarations move tolibkernel'sApi.hpp,guest_kernel_sys_cpusetnow linkslibkernelandlibconly, and their debt entry moves todocs/dev/debt/libkernel.md.rfork_threadandsceKernelRdupmove tolibkernel/Unimplemented.cppwith the prototypes the title uses, FreeBSD'srfork_thread(int flags, void *stack, int (*func)(void *), void *arg)andint sceKernelRdup(int pid, int fd), and still throw. The title callssceKernelRduponly whendupis refused withEPERManddup2onto a reserved number fails (native_trace.c#L157-L188), andrfork_threadonly from a fork probe that is off by default (native_fork_probe.c#L1-L40). Neither is reached in the run below. A debt entry records this. #12826 did the same for MihawkOS'ssceKernelProtectDirectMemoryForPID.guest_kernel_process_exports: it loadslibkernel.prxfrom the unpatched and the patched library directories, resolves the five exports by name and by NID, and callscpuset_getidthrough the resolved pointer (root set 0, process set 1).Tested
Linux: Ubuntu 24.04 container on WSL2, Ryzen 9 7900, GCC 13.3, Release, llvmpipe (the only Vulkan device here).
Title: ProsperoWeb 0.2.1,
PRWB00001.zipfrom kvaps/ProsperoWeb, SHA-256687652cbc05c01db60410c357bc4322f05170de4829ace174d1d5628ba63b0b0, the same as in the homebrew catalog. I converted it with the relinker's default flags (astools/title_run.pydoes) and ran it for 40 s under Xvfb in a container with no network, without input, 3 runs each. Themaincolumn useslibkernel.prxandlibkernel_sys.prxbuilt frommain's sources and the same converted executable.mainc36ab99c74undefined symbol: LxIacrWiJ3w, exit 127, before the entry point (3/3)what(): sysctl_nid_postfix: unsupported MIB 1.14.17.14, exit 134, about 6 s in (3/3)cpu: ... cpuset 0-12 (0x1fff), root set, set for the process | probe 8:okandmain: starting the UIThe new stop is
kern.procwithKERN_PROC_PID \| KERN_PROC_INC_THREAD(17) for its own pid. No open PR handles it.ctest -R "guest_kernel_process_exports|guest_kernel_sys_cpuset|available_cpumask|sched_priority": 5/5 pass. Withcore/libs/prxfrommainand the test kept, both new tests fail:libkernel.prx does not export cpuset_getid_nid_postfix(and the other four names),libkernel.prx does not export DGY7qWLcHGA(and the other four NIDs).ctest -R "kernel|resident|direct_memory|public_headers|progress_|conventions_|patched_libraries|tools_headers|nid_|cpuset|process_exports" -E "^agc_": 203/203 pass.guest_kernel_process_exports,guest_kernel_resident_fmem_export, both_patchedvariants,guest_kernel_sys_cpusetandguest_kernel_syspass (6/6). #16243 merges intomainplus this branch, and this branch intomainplus #16243, with no conflict, and both orders give the same tree.tools/progress.py --module:libkernel705 of 763 (from 703 of 758) andlibkernel_sys158 of 821 (from 160 of 826); the five exports moved.tools/check_conventions.pypasses, with one warning: the moved cpuset debt entry is 1,247 characters, as it already was inlibkernel_sys.md; I moved it without rewording it.maincdf371df68into the branch asc3747080fa. The only conflict was indocs/dev/debt/libkernel_sys.md, where #15035 rewrote thesceKernelSettimeofdayentry next to the moved cpuset entry; I keptmain's line. Full Linux build (GCC 13, Release): the 5 tests above pass, the regex above now runs 206/206, andguest_kernel|libkernel49/49.check_conventions.pygives the same single warning.tools/pr_overlap.pyneeds git 2.38 and this host has 2.34, so I merged the heads of the 197 open PRs that change these files into this branch and intomainone by one: all merge or conflict the same way with both, except #16215, which edits thelibkernel_sys.mdline just above the moved cpuset entry and needs a one-line rebase. #15973 changes one line ofCpuset.cppthat is already onmainand merges cleanly across the move.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)AI disclosure: this change and description were written with Claude Code.
🤖 Generated with Claude Code