From a294b80d29622f674b4c7d28f7d014dcfd6148da Mon Sep 17 00:00:00 2001 From: Pedro Date: Thu, 8 Oct 2026 10:39:06 -0500 Subject: [PATCH] feat(libkernel): implement getuid, geteuid, getgid, getegid and issetugid Part of #1578. --- .../libs/prx/libkernel/System/src/Process.cpp | 20 +++++++++++++++++++ docs/dev/TechnicalDebt.md | 1 + 2 files changed, 21 insertions(+) diff --git a/core/libs/prx/libkernel/System/src/Process.cpp b/core/libs/prx/libkernel/System/src/Process.cpp index 13e447cd1..6d868d558 100644 --- a/core/libs/prx/libkernel/System/src/Process.cpp +++ b/core/libs/prx/libkernel/System/src/Process.cpp @@ -138,6 +138,26 @@ int APS5_VABI getpid_nid_postfix(void) { return static_cast(pid); } +int APS5_VABI getuid_nid_postfix(void) { + return 0; +} + +int APS5_VABI geteuid_nid_postfix(void) { + return 0; +} + +int APS5_VABI getgid_nid_postfix(void) { + return 0; +} + +int APS5_VABI getegid_nid_postfix(void) { + return 0; +} + +int APS5_VABI issetugid_nid_postfix(void) { + return 0; +} + void APS5_VABI exit_nid_postfix(int code) { LibcExit_nid_no_patch(code); } diff --git a/docs/dev/TechnicalDebt.md b/docs/dev/TechnicalDebt.md index f4812dd22..ebf2ae858 100644 --- a/docs/dev/TechnicalDebt.md +++ b/docs/dev/TechnicalDebt.md @@ -38,6 +38,7 @@ Throughout the project, every function at every stage either **does exactly what ### Unknown function info +- [getuid, geteuid, getgid, getegid and issetugid](../../core/libs/prx/libkernel/System/src/Process.cpp) (libkernel) report the root identity (0) and a process that never changed credentials (`issetugid` 0), as a jailbroken process has; the host user and group are not exposed to the guest. The values a title sees on a console are unverified - [sceNpEntitlementAccessGetEntitlementKey](../../core/libs/prx/libSceNpEntitlementAccess/Export.cpp) - the three-argument signature, 16-byte key and errors `0x817D0002`/`0x817D0007` follow [KytyPS5](https://github.com/KytyPS5/KytyPS5/blob/main/src/libs/libNet.cpp); PPSA01521 passes a service label, entitlement label and output pointer. Only the no-key path is implemented: local entitlement labels carry no keys, and the output is untouched on failure. Console error precedence and key provisioning are unverified - [sceRudpGetStatus](../../core/libs/prx/libSceRudp/Export.cpp) - PPSA01521 passes an output pointer and byte count `0xF8`; the status layout, size rules and error behavior are unknown. The export throws without writing output, including after initialization. [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/rudp/rudp.cpp) declares it without arguments and returns success without writing status - [sceHttpSetCookieEnabled](../../core/libs/prx/libSceHttp/Export.cpp) - the two-argument signature and 0/1 enable values follow [VitaSDK](https://github.com/vitasdk/vita-headers/blob/master/include/psp2/net/http.h) and [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/network/http.cpp); PPSA01521 passes 0 to disable cookies. Disabling succeeds because the offline HTTP backend has no cookie engine; enabling throws. Invalid enable values use the same error as `sceHttpSetInflateGZIPEnabled`. Like the existing offline HTTP setters, the handle is not validated; requests still fail with the network error. Console behavior is unverified