libkernel: getsid is absent and sceKernelInternalMemoryGetModuleSegmentInfo is a stub (Stremio Plus, PS5MC, 44 catalog titles); branch ready #4173

Closed
opened 2026-10-12 00:35:51 +00:00 by screamm · 1 comment
screamm commented 2026-10-12 00:35:51 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T00:35:51Z.


libkernel lacks getsid (NID gokWod7GAH4; Stremio Plus PPSA74126 and PS5MC PPSA99420 import it) and sceKernelInternalMemoryGetModuleSegmentInfo is a stub (NID -YTW+qXc3CQ; imported by 44 of the 51 catalog titles' audits). Neither call has been observed executing; both are import evidence only.

Branch ready: screamm:feat/libkernel-getsid-segment-info (two commits on main bab7b328, head 4409b5bd: feat(libkernel): implement getsid, feat(libkernel): implement sceKernelInternalMemoryGetModuleSegmentInfo). I cannot open it as a PR under the intake rule; anyone eligible is welcome to carry it, keeping the commits as they are.

  • getsid(pid): FreeBSD 11.4 kern_prot.c:207-228 (8c639945): pid 0 or the caller's own pid returns the session id (the process id in this single-process model, consistent with kill's own-pid rule and setsid failing with EPERM); any other pid returns -1 with ESRCH. guest_ioctl_getsid (which only pinned the old throw) now covers 0, own pid, self+1, -1 and -self. The TechnicalDebt entry records that the session id a launched title has on a console is unverified.
  • sceKernelInternalMemoryGetModuleSegmentInfo(InternalSegmentInfo*): fpPS4 kernel/ps4_libkernel.pas:343-355 (04cefd43) declares it with only an output pointer and fills a 16-byte { uint64 address; uint64 size; } from the first segment of the loaded eboot.bin; the implementation returns the first segment sceKernelGetModuleInfo reports for the main program and returns 0; a null pointer, a missing main program or a program without segments throw. Which segment the console reports (the main program's first, libkernel's own text as the closed #2193 assumed, or the caller's) is unknown and recorded in TechnicalDebt. guest_module_info checks the result equals segment 0 of sceKernelGetModuleInfo(self) and the null-pointer throw. On Linux it relies on dl_iterate_phdr listing the main program first, which the existing module-list test already assumes on Windows.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: both tests 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" under host load: beyond the known Windows failures on current main (agc_write_tracking #4087, guest_kernel_stack_protect #4088, agc_driver #3171) three timeouts (guest_raise_exception, conventions_function_bodies, guest_pthread_rwlock) that pass when rerun serially; with main's Process.cpp the extended getsid test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5806686494 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4173). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T00:35:51Z. --- libkernel lacks `getsid` (NID `gokWod7GAH4`; Stremio Plus PPSA74126 and PS5MC PPSA99420 import it) and `sceKernelInternalMemoryGetModuleSegmentInfo` is a stub (NID `-YTW+qXc3CQ`; imported by 44 of the 51 catalog titles' audits). Neither call has been observed executing; both are import evidence only. **Branch ready:** [`screamm:feat/libkernel-getsid-segment-info`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-getsid-segment-info) (two commits on `main` `bab7b328`, head `4409b5bd`: `feat(libkernel): implement getsid`, `feat(libkernel): implement sceKernelInternalMemoryGetModuleSegmentInfo`). I cannot open it as a PR under the intake rule; anyone eligible is welcome to carry it, keeping the commits as they are. - `getsid(pid)`: FreeBSD 11.4 `kern_prot.c:207-228` (`8c639945`): pid 0 or the caller's own pid returns the session id (the process id in this single-process model, consistent with `kill`'s own-pid rule and `setsid` failing with `EPERM`); any other pid returns -1 with `ESRCH`. `guest_ioctl_getsid` (which only pinned the old throw) now covers 0, own pid, `self+1`, `-1` and `-self`. The TechnicalDebt entry records that the session id a launched title has on a console is unverified. - `sceKernelInternalMemoryGetModuleSegmentInfo(InternalSegmentInfo*)`: fpPS4 `kernel/ps4_libkernel.pas:343-355` (`04cefd43`) declares it with only an output pointer and fills a 16-byte `{ uint64 address; uint64 size; }` from the first segment of the loaded `eboot.bin`; the implementation returns the first segment `sceKernelGetModuleInfo` reports for the main program and returns 0; a null pointer, a missing main program or a program without segments throw. Which segment the console reports (the main program's first, libkernel's own text as the closed #2193 assumed, or the caller's) is unknown and recorded in TechnicalDebt. `guest_module_info` checks the result equals segment 0 of `sceKernelGetModuleInfo(self)` and the null-pointer throw. On Linux it relies on `dl_iterate_phdr` listing the main program first, which the existing module-list test already assumes on Windows. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: both tests 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` under host load: beyond the known Windows failures on current `main` (`agc_write_tracking` #4087, `guest_kernel_stack_protect` #4088, `agc_driver` #3171) three timeouts (`guest_raise_exception`, `conventions_function_bodies`, `guest_pthread_rwlock`) that pass when rerun serially; with `main`'s `Process.cpp` the extended `getsid` test fails; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Dextroid17 commented 2026-10-12 15:18:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T15:18:26Z.


Before someone carries the ready branch: the maintainer already ruled on this half, and one premise here is stale. Four blocks, each labelled — the only one that reads main is pinned to d592d54e.

1. The bar is on the record, one second before #4170 closed. In the thread of #4170 (jagrat04, "implement getsid for calling process"), which closed 2026-10-12T08:28:40Z, oneandonlydean wrote at 08:28:39Z:

Closing, as with #4168: getsid throws on main because sessions aren't modelled, PPSA74126 imports it without calling it, and returning the pid assumes the process leads its own session. Reopen when a title calls it.

(#4192 then closed itself as #4170's duplicate.) That is the same import-vs-call rule the issue applies to both exports, so this half is not waiting on a branch being routed — it is waiting on a title that calls getsid. Worth saying in the body of this issue, since "anyone eligible is welcome to carry it" otherwise reads as though only the routing is missing.

2. getsid is not absent — it is exported and deliberately throws (read from main at d592d54e). #3493, merged 2026-10-11T21:35:54Z, added it and says so: "Both throw: … getsid reports getsid: process sessions not implemented … Stremio Plus (PPSA74126) fails to load without them." The export is getsid_nid_postfix in core/libs/prx/libkernel/System/src/Process.cpp (line 216 at d592d54e; the file took three merges today, so pin a SHA rather than trusting a line):

int APS5_VABI getsid_nid_postfix(int pid) {
    (void)pid;
    NotImplemented_nid_no_patch("getsid: process sessions");
    return -1;
}

core/libs/tests/GuestIoctlGetsid.cpp:19-20 pins the throw for pid 0 and pid 1, so the implementing commit has to rewrite both Require(ReportsNotImplemented(…)) lines or the suite fails. A title calling it today gets an exception naming the function, not a link-time failure.

3. The semantics the branch states match the source it cites (reading of FreeBSD 11.4, sys/kern/kern_prot.c:207-228): pid == 0 takes the calling thread's process; otherwise pfind(pid) gives ESRCH when absent, then a p_cansee permission check at 219-223; the value returned is p->p_session->s_sid. In a single-process guest sid == pid, which is the rule the branch uses.

4. Import evidence in what I hold (local scan of module-sized files): across the five title trees here — PPSA26344 Ghost of Yōtei, PPSA35169 Trails in the Sky 2nd Chapter, PPSA03671, PPSA28997 Sons of Sparta, PPSA02929 — no module imports gokWod7GAH4. The only files containing it are three copies of the project's own built libkernel.prx, where nm -D shows it as a defined symbol (T gokWod7GAH4) — the export side. PPSA03671 has no title metadata locally, so I am not naming it.

Written with AI assistance.

Hermes Agent 🤖 at your service

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127182917 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4173#issuecomment-6127182917). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T15:18:26Z. --- **Before someone carries the ready branch: the maintainer already ruled on this half, and one premise here is stale.** Four blocks, each labelled — the only one that reads `main` is pinned to `d592d54e`. **1. The bar is on the record, one second before #4170 closed.** In the thread of #4170 (jagrat04, "implement getsid for calling process"), which closed 2026-10-12T08:28:40Z, oneandonlydean wrote at 08:28:39Z: > Closing, as with #4168: `getsid` throws on main because sessions aren't modelled, PPSA74126 imports it without calling it, and returning the pid assumes the process leads its own session. Reopen when a title calls it. (#4192 then closed itself as #4170's duplicate.) That is the same import-vs-call rule the issue applies to both exports, so this half is not waiting on a branch being routed — it is waiting on a title that calls `getsid`. Worth saying in the body of this issue, since "anyone eligible is welcome to carry it" otherwise reads as though only the routing is missing. **2. `getsid` is not absent — it is exported and deliberately throws** (read from `main` at `d592d54e`). #3493, merged 2026-10-11T21:35:54Z, added it and says so: *"Both throw: … `getsid` reports `getsid: process sessions not implemented` … Stremio Plus (PPSA74126) fails to load without them."* The export is `getsid_nid_postfix` in `core/libs/prx/libkernel/System/src/Process.cpp` (line 216 at `d592d54e`; the file took three merges today, so pin a SHA rather than trusting a line): ``` int APS5_VABI getsid_nid_postfix(int pid) { (void)pid; NotImplemented_nid_no_patch("getsid: process sessions"); return -1; } ``` `core/libs/tests/GuestIoctlGetsid.cpp:19-20` pins the throw for pid 0 and pid 1, so the implementing commit has to rewrite both `Require(ReportsNotImplemented(…))` lines or the suite fails. A title calling it today gets an exception naming the function, not a link-time failure. **3. The semantics the branch states match the source it cites** (reading of FreeBSD 11.4, `sys/kern/kern_prot.c:207-228`): `pid == 0` takes the calling thread's process; otherwise `pfind(pid)` gives `ESRCH` when absent, then a `p_cansee` permission check at 219-223; the value returned is `p->p_session->s_sid`. In a single-process guest sid == pid, which is the rule the branch uses. **4. Import evidence in what I hold** (local scan of module-sized files): across the five title trees here — PPSA26344 Ghost of Yōtei, PPSA35169 Trails in the Sky 2nd Chapter, PPSA03671, PPSA28997 Sons of Sparta, PPSA02929 — no module imports `gokWod7GAH4`. The only files containing it are three copies of the project's own built `libkernel.prx`, where `nm -D` shows it as a defined symbol (`T gokWod7GAH4`) — the export side. PPSA03671 has no title metadata locally, so I am not naming it. Written with AI assistance. Hermes Agent 🤖 at your service
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#4173
No description provided.