feat(libkernel): implement setgid #7940

Merged
pushkarreddyy merged 1 commit from upstream-pr/7940 into main 2026-10-20 04:05:47 +00:00
pushkarreddyy commented 2026-10-19 15:12:26 +00:00 (Migrated from github.com)

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


What

Implement setgid_nid_postfix (FreeBSD syscall 181, NID fqFN+ydTbT0) in libkernel to complete POSIX process credential parity alongside existing setuid, seteuid, setegid, setreuid, and setregid exports.

As with its sibling setuid, AnyPS5 models the single-process guest environment with root privileges (real, effective, and saved ids 0). Id 0 is accepted without changing credentials and returns 0; any non-zero group id throws std::runtime_error("setgid: unsupported group id ...").

Update docs/dev/debt/libkernel.md under # Process credentials to document the setgid root assumption.

Tested

Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0, Release:

  • Ran core/libs/tests/GuestCredentials.cpp assertions verifying:
    • setgid_nid_postfix(0) == 0
    • Rejection with std::runtime_error when passed unsupported non-zero group ID (1000)
    • Rejection with std::runtime_error when passed Unchanged (0xffffffffu, which is only accepted by setregid)
  • Verified all credentials tests pass without modifying guest errno.
  • python tools/check_conventions.py --base origin/main passed with 0 findings and 0 errors.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4923163567 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7940). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-19T15:12:26Z. --- ### What Implement `setgid_nid_postfix` (FreeBSD syscall 181, NID `fqFN+ydTbT0`) in `libkernel` to complete POSIX process credential parity alongside existing `setuid`, `seteuid`, `setegid`, `setreuid`, and `setregid` exports. As with its sibling `setuid`, AnyPS5 models the single-process guest environment with root privileges (real, effective, and saved ids 0). Id 0 is accepted without changing credentials and returns 0; any non-zero group id throws `std::runtime_error("setgid: unsupported group id ...")`. Update `docs/dev/debt/libkernel.md` under `# Process credentials` to document the `setgid` root assumption. ### Tested Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0, Release: - Ran `core/libs/tests/GuestCredentials.cpp` assertions verifying: - `setgid_nid_postfix(0) == 0` - Rejection with `std::runtime_error` when passed unsupported non-zero group ID (`1000`) - Rejection with `std::runtime_error` when passed `Unchanged` (`0xffffffffu`, which is only accepted by `setregid`) - Verified all credentials tests pass without modifying guest errno. - `python tools/check_conventions.py --base origin/main` passed with 0 findings and 0 errors. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-19 15:13:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T15:13:16Z.


Progress report (00d7e61 → a1b6caa)

📈 System libraries: 79.75% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel setgid_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6270596322 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7940#issuecomment-6270596322). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T15:13:16Z. --- <!-- progress-report --> ### Progress report (00d7e61 → a1b6caa) 📈 **System libraries**: 79.75% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `setgid_nid_postfix` | </details>
github-actions[bot] commented 2026-10-19 15:17:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T15:17:38Z.


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.

Pull request Shared files not compared
PR 5021 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestCredentials.cpp
PR 6149 docs/dev/debt/libkernel.md
PR 6469 docs/dev/debt/libkernel.md
PR 6519 docs/dev/debt/libkernel.md
PR 6740 docs/dev/debt/libkernel.md
PR 6879 core/libs/prx/libkernel/System/src/Process.cpp
PR 6977 docs/dev/debt/libkernel.md
PR 7049 docs/dev/debt/libkernel.md
PR 7088 docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7121 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 docs/dev/debt/libkernel.md
PR 7201 core/libs/prx/libkernel/System/src/Process.cpp
PR 7509 docs/dev/debt/libkernel.md
PR 7554 docs/dev/debt/libkernel.md
PR 7556 docs/dev/debt/libkernel.md
PR 7605 docs/dev/debt/libkernel.md
PR 7949 docs/dev/debt/libkernel.md
PR 7965 docs/dev/debt/libkernel.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6270690570 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7940#issuecomment-6270690570). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T15:17:38Z. --- <!-- pr-overlap --> 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. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestCredentials.cpp` | | [PR 6149](https://www.github.com/boykopovar/AnyPS5/pull/6149) | `docs/dev/debt/libkernel.md` | | [PR 6469](https://www.github.com/boykopovar/AnyPS5/pull/6469) | `docs/dev/debt/libkernel.md` | | [PR 6519](https://www.github.com/boykopovar/AnyPS5/pull/6519) | `docs/dev/debt/libkernel.md` | | [PR 6740](https://www.github.com/boykopovar/AnyPS5/pull/6740) | `docs/dev/debt/libkernel.md` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libkernel/System/src/Process.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `docs/dev/debt/libkernel.md` | | [PR 7049](https://www.github.com/boykopovar/AnyPS5/pull/7049) | `docs/dev/debt/libkernel.md` | | [PR 7088](https://www.github.com/boykopovar/AnyPS5/pull/7088) | `docs/dev/debt/libkernel.md` | | [PR 7105](https://www.github.com/boykopovar/AnyPS5/pull/7105) | `docs/dev/debt/libkernel.md` | | [PR 7121](https://www.github.com/boykopovar/AnyPS5/pull/7121) | `docs/dev/debt/libkernel.md` | | [PR 7149](https://www.github.com/boykopovar/AnyPS5/pull/7149) | `docs/dev/debt/libkernel.md` | | [PR 7192](https://www.github.com/boykopovar/AnyPS5/pull/7192) | `docs/dev/debt/libkernel.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libkernel/System/src/Process.cpp` | | [PR 7509](https://www.github.com/boykopovar/AnyPS5/pull/7509) | `docs/dev/debt/libkernel.md` | | [PR 7554](https://www.github.com/boykopovar/AnyPS5/pull/7554) | `docs/dev/debt/libkernel.md` | | [PR 7556](https://www.github.com/boykopovar/AnyPS5/pull/7556) | `docs/dev/debt/libkernel.md` | | [PR 7605](https://www.github.com/boykopovar/AnyPS5/pull/7605) | `docs/dev/debt/libkernel.md` | | [PR 7949](https://www.github.com/boykopovar/AnyPS5/pull/7949) | `docs/dev/debt/libkernel.md` | | [PR 7965](https://www.github.com/boykopovar/AnyPS5/pull/7965) | `docs/dev/debt/libkernel.md` |
Sign in to join this conversation.
No reviewers
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!7940
No description provided.