libkernel: getpriority, chflags, chroot and clock_settime are absent (PS5MC, Porpoise); branch ready #3632

Closed
opened 2026-10-11 14:28:59 +00:00 by screamm · 4 comments
screamm commented 2026-10-11 14:28:59 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T14:28:59Z.


libkernel/libkernel_sys lack getpriority (miQ1wVwSexE), chflags (ixrw0h2tWuI), chroot (AKknh8Cx-V8, libkernel_sys) and clock_settime (d7nUj1LOdDU). From the relink registry order they are predicted stops of PS5MC (PPSA99420, indices 449, 450, 480) and Porpoise (PPSA99764, chroot at 346); not yet observed in a run.

Branch ready: screamm:feat/libkernel-ps5mc-set (four commits on main a11c8f7f, head 43dc8bc4e: 63262245 getpriority, 16e5b7cc chflags, 32f46bd9 chroot, then clock_settime). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commits as they are. FreeBSD source pin 11.4 8c639945.

  • getpriority(which, who) (kern_resource.c): the guest is one process at nice 0 leading its own group (as kill/setsid assume): 0 for the caller by process, group or user (id 0 or its own), ESRCH for other ids, EINVAL for an unknown which; errno is not cleared on success, as FreeBSD's libc leaves it.
  • chflags(path, flags) (kern_chflagsat, UFS ufs_setattr): resolved through the guest resolver like chmod; EFAULT/ENOENT/ENOTDIR from the lookup, unknown bits EOPNOTSUPP (UFS), SF_SNAPSHOT EPERM, flags 0 succeed, any other valid flag throws naming it (UF_READONLY is deliberately not mapped to the Windows read-only attribute, which already carries chmod's owner write bit, and Linux has no unprivileged equivalent).
  • chroot(path) (sys_chroot, change_dir): EFAULT, ENOENT, ENOTDIR; any found directory throws naming it, because the resolver's root is fixed and the mount aliases are host paths.
  • clock_settime(clock, ts) (kern_clock_settime): EFAULT for a null time, EINVAL for a non-realtime clock or an out-of-range time; a valid request throws naming the requested time (the host clock is never set).
  • guest_sched_priority and guest_freebsd_clocks gain the cases; the chflags and chroot cases sit in guest_filesystem/guest_kernel_sys, which on this host still stop earlier on the known main problems (#3518 directory time, #3510 symlink) and pass 3/3 with those cases bypassed.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: the two runnable tests 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 533/536, the failures being the known windows_exceptions (#3411), guest_kernel_sys (#3510) and guest_filesystem (#3518); with main's Process.cpp the extended priority 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:5801965902 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3632). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T14:28:59Z. --- libkernel/libkernel_sys lack `getpriority` (`miQ1wVwSexE`), `chflags` (`ixrw0h2tWuI`), `chroot` (`AKknh8Cx-V8`, libkernel_sys) and `clock_settime` (`d7nUj1LOdDU`). From the relink registry order they are predicted stops of PS5MC (PPSA99420, indices 449, 450, 480) and Porpoise (PPSA99764, `chroot` at 346); not yet observed in a run. **Branch ready:** [`screamm:feat/libkernel-ps5mc-set`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-ps5mc-set) (four commits on `main` `a11c8f7f`, head `43dc8bc4e`: `63262245` getpriority, `16e5b7cc` chflags, `32f46bd9` chroot, then clock_settime). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commits as they are. FreeBSD source pin 11.4 `8c639945`. - `getpriority(which, who)` (`kern_resource.c`): the guest is one process at nice 0 leading its own group (as `kill`/`setsid` assume): 0 for the caller by process, group or user (id 0 or its own), `ESRCH` for other ids, `EINVAL` for an unknown `which`; errno is not cleared on success, as FreeBSD's libc leaves it. - `chflags(path, flags)` (`kern_chflagsat`, UFS `ufs_setattr`): resolved through the guest resolver like `chmod`; `EFAULT`/`ENOENT`/`ENOTDIR` from the lookup, unknown bits `EOPNOTSUPP` (UFS), `SF_SNAPSHOT` `EPERM`, flags 0 succeed, any other valid flag throws naming it (`UF_READONLY` is deliberately not mapped to the Windows read-only attribute, which already carries `chmod`'s owner write bit, and Linux has no unprivileged equivalent). - `chroot(path)` (`sys_chroot`, `change_dir`): `EFAULT`, `ENOENT`, `ENOTDIR`; any found directory throws naming it, because the resolver's root is fixed and the mount aliases are host paths. - `clock_settime(clock, ts)` (`kern_clock_settime`): `EFAULT` for a null time, `EINVAL` for a non-realtime clock or an out-of-range time; a valid request throws naming the requested time (the host clock is never set). - `guest_sched_priority` and `guest_freebsd_clocks` gain the cases; the `chflags` and `chroot` cases sit in `guest_filesystem`/`guest_kernel_sys`, which on this host still stop earlier on the known `main` problems (#3518 directory time, #3510 symlink) and pass 3/3 with those cases bypassed. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: the two runnable tests 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 533/536, the failures being the known `windows_exceptions` (#3411), `guest_kernel_sys` (#3510) and `guest_filesystem` (#3518); with `main`'s `Process.cpp` the extended priority 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).
MarcZX10 commented 2026-10-11 14:54:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T14:54:23Z.


I carried all four commits from David’s ready branch into PR #3654, preserving his authorship. The Linux/GCC 12.2 Release tests pass for guest_sched_priority, guest_filesystem, guest_kernel_sys, and guest_freebsd_clocks; conventions and git diff --check also pass on current main. The predicted PS5MC/Porpoise stops have not been confirmed in a title run. The PR is independent of #3650; I kept their shared-file changes in separate hunks and verified the branches merge cleanly.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110286591 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3632#issuecomment-6110286591). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T14:54:23Z. --- I carried all four commits from David’s ready branch into [PR #3654](https://github.com/boykopovar/AnyPS5/pull/3654), preserving his authorship. The Linux/GCC 12.2 Release tests pass for `guest_sched_priority`, `guest_filesystem`, `guest_kernel_sys`, and `guest_freebsd_clocks`; conventions and `git diff --check` also pass on current `main`. The predicted PS5MC/Porpoise stops have not been confirmed in a title run. The PR is independent of #3650; I kept their shared-file changes in separate hunks and verified the branches merge cleanly.
MarcZX10 commented 2026-10-12 08:30:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T08:30:25Z.


I carried the chroot portion of the ready branch into PR #4384, preserving David’s original commit author. The focused Linux Release guest_kernel_sys test passed 1/1, and conventions/diff checks passed. Existing directories return an explicit unsupported-root-change error; invalid and missing paths retain the guest lookup errors.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120610076 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3632#issuecomment-6120610076). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:30:25Z. --- I carried the `chroot` portion of the ready branch into [PR #4384](https://github.com/boykopovar/AnyPS5/pull/4384), preserving David’s original commit author. The focused Linux Release `guest_kernel_sys` test passed 1/1, and conventions/diff checks passed. Existing directories return an explicit unsupported-root-change error; invalid and missing paths retain the guest lookup errors.
screamm commented 2026-10-13 10:34:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-13T10:34:05Z.


Porpoise (PPSA99764) now reaches chroot on main: fifth catalog run, FAIL: unresolved ELF import AKknh8Cx-V8 from libkernel_sys.prx (exit 0xC0000139 at load). Branch ready: screamm:feat/libkernel-sys-chroot (two commits on main 77b9f727: 059d98cf the chroot commit from this issue's branch, 15f673ee feat(libkernel_sys): let chroot keep the guest root). Anyone eligible is welcome to carry it, keeping the commits as they are.

  • What the title does (elripalda/Porpoise-Dolphin-Emulator-for-PS5 2ed1ab5a, src/porpoise_jailbreak.cpp put_root_back): it weak-imports chroot, and its one call is fchdir(g_sandbox_root) then chroot(".") with g_sandbox_root a descriptor of / opened at start, followed by chdir("/"); it only ever restores the root it started with. So, following FreeBSD 11.4 sys_chroot/pwd_chroot (8c639945), a chroot to the current guest root succeeds and changes nothing (/, /.., //./, .. from a top-level directory, the fchdir + chroot(".") pattern); the lookup errors stay (EFAULT, ENOENT, ENOTDIR including file/.., and ENAMETOOLONG with pathconf's rules); any other directory still throws naming the path, because the resolver's root is fixed. Recorded in docs/dev/debt/libkernel_sys.md: the console refuses chroot with EPERM from a sandbox while a directory is open, and whether a title holds the privilege at all, are not modelled.
  • guest_kernel_sys gains the lookup errors, Porpoise's exact pattern with the descriptor open, getcwd unchanged after chroot, relative and absolute opens and .. escapes still resolving under the root, and the throw for another directory.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_kernel_sys, guest_working_directory, guest_realpath 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 685/689 under host load, the four (guest_file_lock_process, guest_raise_exception, tls_function_coverage_register_address_loads, conventions_function_bodies) passing when rerun serially; with main's libkernel_sys/Export.cpp the extended test fails; conventions and git diff --check pass. Porpoise relinked against this build gets past the import, creates its swapchain and stops at 3.5 s on what(): VideoOut: port already open (#4863). Not run on Linux.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143633213 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3632#issuecomment-6143633213). Originally posted by [screamm](https://github.com/screamm) on 2026-10-13T10:34:05Z. --- Porpoise (PPSA99764) now reaches `chroot` on `main`: fifth catalog run, `FAIL: unresolved ELF import AKknh8Cx-V8 from libkernel_sys.prx` (exit 0xC0000139 at load). Branch ready: [`screamm:feat/libkernel-sys-chroot`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-sys-chroot) (two commits on `main` `77b9f727`: `059d98cf` the chroot commit from this issue's branch, `15f673ee` `feat(libkernel_sys): let chroot keep the guest root`). Anyone eligible is welcome to carry it, keeping the commits as they are. - What the title does (elripalda/Porpoise-Dolphin-Emulator-for-PS5 `2ed1ab5a`, `src/porpoise_jailbreak.cpp` `put_root_back`): it weak-imports `chroot`, and its one call is `fchdir(g_sandbox_root)` then `chroot(".")` with `g_sandbox_root` a descriptor of `/` opened at start, followed by `chdir("/")`; it only ever restores the root it started with. So, following FreeBSD 11.4 `sys_chroot`/`pwd_chroot` (`8c639945`), a chroot to the current guest root succeeds and changes nothing (`/`, `/..`, `//./`, `..` from a top-level directory, the `fchdir` + `chroot(".")` pattern); the lookup errors stay (`EFAULT`, `ENOENT`, `ENOTDIR` including `file/..`, and `ENAMETOOLONG` with `pathconf`'s rules); any other directory still throws naming the path, because the resolver's root is fixed. Recorded in `docs/dev/debt/libkernel_sys.md`: the console refuses `chroot` with `EPERM` from a sandbox while a directory is open, and whether a title holds the privilege at all, are not modelled. - `guest_kernel_sys` gains the lookup errors, Porpoise's exact pattern with the descriptor open, `getcwd` unchanged after `chroot`, relative and absolute opens and `..` escapes still resolving under the root, and the throw for another directory. Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: `guest_kernel_sys`, `guest_working_directory`, `guest_realpath` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 685/689 under host load, the four (`guest_file_lock_process`, `guest_raise_exception`, `tls_function_coverage_register_address_loads`, `conventions_function_bodies`) passing when rerun serially; with `main`'s `libkernel_sys/Export.cpp` the extended test fails; conventions and `git diff --check` pass. Porpoise relinked against this build gets past the import, creates its swapchain and stops at 3.5 s on `what(): VideoOut: port already open` (#4863). Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
oneandonlydean commented 2026-10-14 00:09:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T00:09:24Z.


All four are on main now: getpriority #4374, chflags #4379, chroot #5191, clock_settime #5183. Closing; comment here if PS5MC or Porpoise still stops on one of them.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157878744 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3632#issuecomment-6157878744). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T00:09:24Z. --- All four are on main now: `getpriority` #4374, `chflags` #4379, `chroot` #5191, `clock_settime` #5183. Closing; comment here if PS5MC or Porpoise still stops on one of them.
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#3632
No description provided.