fix(libkernel): resolve kern.proc.proc by name #14591

Merged
ahmadmuj merged 1 commit from upstream-pr/14591 into main 2026-11-02 22:39:55 +00:00
ahmadmuj commented 2026-11-01 16:11:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-11-01T16:11:46Z.


What

#13532 added sysctl {1, 14, 8} (kern.proc.proc), but the name paths were never wired up, so sysctlbyname("kern.proc.proc") and sysctlnametomib("kern.proc.proc") still return -1 with ENOENT. kern.proc.pathname already has both.

This maps the name to {1, 14, 8} in both places, the way FreeBSD 11.4 does it: kern_proc.c registers the node as proc under kern.proc, and sysctlbyname is just the name lookup plus a numeric sysctl. So the name reaches the existing handler with 3 elements, which sysctl_kern_proc accepts for KERN_PROC_PROC.

No new behaviour in the handler. The open gaps in the kern.proc.proc debt entry (one process, record size, size estimate) apply the same way to the name, so the entry stays as is. I don't know of a title that asks for this by name; it just closes the name/number mismatch #13532 left.

Tested

Ubuntu 24.04 on WSL2, GCC 13.3, Release build.

  • guest_system_configuration: fails on main with the new checks (aborts at the named size query, and at the sysctlnametomib table row with only the sysctlbyname change), passes with the fix, 3 runs.
  • The new checks compare the named read byte for byte with the numeric {1, 14, 8} read, and check the size query, ENOMEM on a 100-byte buffer (length kept), EPERM on a write, and the sysctlnametomib MIB {1, 14, 8} with size 3.
  • public_headers: pass. python3 tools/check_conventions.py --base origin/main: pass.
  • No console or dump test; nothing GPU related.

Overlap: tools/pr_overlap.py --branch reports no overlap with the 1,790 open PRs. A paginated pulls/files scan lists both files in 14 old PRs (#9588, #9688, #10113, #10226, #10229, #10247, #10317, #10349, #10351, #10469, #10492, #12053, #12299, #12598), but that's main's history showing through their old base: at each head both files have the same blob as at its merge base with main, so none of them changes sysctlbyname, sysctlnametomib, CheckProcessListSysctl or CheckNameToMib.

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:5109130563 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14591). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-11-01T16:11:46Z. --- ### What #13532 added `sysctl` {1, 14, 8} (`kern.proc.proc`), but the name paths were never wired up, so `sysctlbyname("kern.proc.proc")` and `sysctlnametomib("kern.proc.proc")` still return -1 with `ENOENT`. `kern.proc.pathname` already has both. This maps the name to {1, 14, 8} in both places, the way FreeBSD 11.4 does it: [`kern_proc.c`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/kern/kern_proc.c#L2949-L2950) registers the node as `proc` under `kern.proc`, and [`sysctlbyname`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/libc/gen/sysctlbyname.c) is just the name lookup plus a numeric `sysctl`. So the name reaches the existing handler with 3 elements, which [`sysctl_kern_proc`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/kern/kern_proc.c#L1452-L1455) accepts for `KERN_PROC_PROC`. No new behaviour in the handler. The open gaps in the `kern.proc.proc` debt entry (one process, record size, size estimate) apply the same way to the name, so the entry stays as is. I don't know of a title that asks for this by name; it just closes the name/number mismatch #13532 left. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Ubuntu 24.04 on WSL2, GCC 13.3, Release build. - `guest_system_configuration`: fails on `main` with the new checks (aborts at the named size query, and at the `sysctlnametomib` table row with only the `sysctlbyname` change), passes with the fix, 3 runs. - The new checks compare the named read byte for byte with the numeric {1, 14, 8} read, and check the size query, `ENOMEM` on a 100-byte buffer (length kept), `EPERM` on a write, and the `sysctlnametomib` MIB {1, 14, 8} with size 3. - `public_headers`: pass. `python3 tools/check_conventions.py --base origin/main`: pass. - No console or dump test; nothing GPU related. Overlap: `tools/pr_overlap.py --branch` reports no overlap with the 1,790 open PRs. A paginated `pulls/files` scan lists both files in 14 old PRs (#9588, #9688, #10113, #10226, #10229, #10247, #10317, #10349, #10351, #10469, #10492, #12053, #12299, #12598), but that's main's history showing through their old base: at each head both files have the same blob as at its merge base with main, so none of them changes `sysctlbyname`, `sysctlnametomib`, `CheckProcessListSysctl` or `CheckNameToMib`. ### 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
MarcZX10 commented 2026-11-01 16:15:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T16:15:34Z.

Review: APPROVED


Reviewed — looks good

The name lookup maps to the existing {1, 14, 8} handler, and the added tests cover named/numeric equivalence plus the relevant size, short-buffer, and write cases.

What I ran

Reviewed exact head 00f69414ba3401fa71c394f733d86715fd7334bf against PR base/current main f2d874c1fdccf781c0fa5d86619bb5dd8894b958; the merge preview completed cleanly. Environment: Debian GNU/Linux 12, Python 3.11.2; no build or compiler run.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14591
python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 00f69414ba3401fa71c394f733d86715fd7334bf --title 'fix(libkernel): resolve kern.proc.proc by name' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/pr-body.md
git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...00f69414ba3401fa71c394f733d86715fd7334bf
git merge-tree --write-tree f2d874c1fdccf781c0fa5d86619bb5dd8894b958 00f69414ba3401fa71c394f733d86715fd7334bf
gh pr checks 14591 -R boykopovar/AnyPS5

Results

Check Result
Diff check Passed; no whitespace errors.
Conventions and PR template Passed.
Merge preview Clean against current main.
Test registration Confirmed: GuestSystemConfiguration.cpp is registered by the libkernel CMake file.
Source behavior FreeBSD 11.4 registers proc under kern.proc as MIB value 8; the existing AnyPS5 handler accepts {1, 14, 8}.
PR precheck Diff, conventions, and dependency/mergeability checks passed. Its ABI and test-quality helper steps could not run because those workspace-local scripts are absent from the PR snapshot.
Hosted CI Still queued when checked.
C++ test run Not run locally. The PR description reports three passing Release runs on Ubuntu 24.04/WSL2; that result is author-reported, not independently reproduced here.
Unedited selected command output

git diff --check:

[no output; exit status 0]

Conventions:

All conventions checks passed.

Merge preview:

6a094365710ea6d3307ce138d2268e08951e719b

Hosted checks:

conventions	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41325062421/job/124903164690
eligibility	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41325062493/job/124903163631
intake	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41325062391/job/124903164580
labels	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41325062394/job/124903164490
library-portability	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41325062415/job/124903163420
report	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41325062503/job/124903163877

The precheck reported these unavailable helper scripts in the detached PR snapshot:

/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/head-00f69414ba34-24316de3/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/head-00f69414ba34-24316de3/tools/pr_test_quality.py': [Errno 2] No such file or directory

Sources

Not verified

I did not build or run CTest locally, and hosted checks were pending. No console or title behavior was tested.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729003396 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14591#pullrequestreview-5729003396). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T16:15:34Z. **Review:** APPROVED --- # Reviewed — looks good The name lookup maps to the existing `{1, 14, 8}` handler, and the added tests cover named/numeric equivalence plus the relevant size, short-buffer, and write cases. ## What I ran Reviewed exact head `00f69414ba3401fa71c394f733d86715fd7334bf` against PR base/current `main` `f2d874c1fdccf781c0fa5d86619bb5dd8894b958`; the merge preview completed cleanly. Environment: Debian GNU/Linux 12, Python 3.11.2; no build or compiler run. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14591 python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 00f69414ba3401fa71c394f733d86715fd7334bf --title 'fix(libkernel): resolve kern.proc.proc by name' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/pr-body.md git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...00f69414ba3401fa71c394f733d86715fd7334bf git merge-tree --write-tree f2d874c1fdccf781c0fa5d86619bb5dd8894b958 00f69414ba3401fa71c394f733d86715fd7334bf gh pr checks 14591 -R boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Diff check | Passed; no whitespace errors. | | Conventions and PR template | Passed. | | Merge preview | Clean against current `main`. | | Test registration | Confirmed: `GuestSystemConfiguration.cpp` is registered by the libkernel CMake file. | | Source behavior | FreeBSD 11.4 registers `proc` under `kern.proc` as MIB value 8; the existing AnyPS5 handler accepts `{1, 14, 8}`. | | PR precheck | Diff, conventions, and dependency/mergeability checks passed. Its ABI and test-quality helper steps could not run because those workspace-local scripts are absent from the PR snapshot. | | Hosted CI | Still queued when checked. | | C++ test run | Not run locally. The PR description reports three passing Release runs on Ubuntu 24.04/WSL2; that result is author-reported, not independently reproduced here. | <details><summary>Unedited selected command output</summary> `git diff --check`: ```text [no output; exit status 0] ``` Conventions: ```text All conventions checks passed. ``` Merge preview: ```text 6a094365710ea6d3307ce138d2268e08951e719b ``` Hosted checks: ```text conventions pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062421/job/124903164690 eligibility pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062493/job/124903163631 intake pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062391/job/124903164580 labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062394/job/124903164490 library-portability pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062415/job/124903163420 report pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41325062503/job/124903163877 ``` The precheck reported these unavailable helper scripts in the detached PR snapshot: ```text /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/head-00f69414ba34-24316de3/tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14591-00f69414ba34/head-00f69414ba34-24316de3/tools/pr_test_quality.py': [Errno 2] No such file or directory ``` </details> ## Sources - [The new lookup and MIB entry at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/00f69414ba3401fa71c394f733d86715fd7334bf/core/libs/prx/libkernel/System/src/SystemConfiguration.cpp) - [The existing handler and tests at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/00f69414ba3401fa71c394f733d86715fd7334bf/core/libs/tests/GuestSystemConfiguration.cpp) - [FreeBSD 11.4 `kern.proc.proc` registration](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/kern/kern_proc.c) - [FreeBSD 11.4 `sysctlbyname` dispatch through name-to-MIB lookup](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/lib/libc/gen/sysctlbyname.c) ## Not verified I did not build or run CTest locally, and hosted checks were pending. No console or title behavior was tested.
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!14591
No description provided.