Repository navigation
test(libkernel): audit sysctl security and jail nodes, bounds, and ENOENT rejection - #21026
Conversation
9fbf9dd to
9cd3abe
Compare
|
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.
|
|
Windows result for head The test builds cleanly and every The PR's own Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, Not run on a PS5. AI-assisted: yes (Claude Code), the runs and the output above are from this machine. |
9cd3abe to
631e888
Compare
|
Thanks @maskym! Caught |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
Material uncertainty remains because the test’s asserted MIB and exception behavior do not consistently match the implementation at this head.
What I ran
Reviewed head 631e88862bbbedb4d3adab02ec23dcbdae6c4f26. No test commands were run. Read the prepared description, commit list, manifest, diff, review README, both changed files, and targeted sysctl implementation ranges using repo_read.py.
Results
| Check | Result | Note |
|---|---|---|
| Changed-file review | passed | Both changed files read |
| Runtime test | not run | No build or test environment available |
Findings
Blocking
None verified.
Non-blocking
sysctlnametomib_nid_postfix("security", ...)resolvessecuritythroughTopLevelNodeto a valid top-level MIB, while the test expectsENOENT(changed linecore/libs/tests/GuestKernelSysctlSecurityNodes.cpp:141). This assertion appears inconsistent with the current implementation.- The test expects
sysctl_nid_postfixto throw for a write to{10, 1, 1}(changed linecore/libs/tests/GuestKernelSysctlSecurityNodes.cpp:165), but writes under absent top-level nodes setEPERMand return-1; the implementation only throws for thename[0] >= 256/other unsupported branch. Align the test’s expected behavior with the implementation or the intended contract.
Not verified
The described ctest --test-dir build -R guest_kernel_sysctl_security_nodes_tests was not run. No build configuration or platform-specific behavior was verified. files.json was not present in the prepared review folder; the manifest lists both changed files as included, and both were read. No files were excluded according to the available manifest.
To get this to a good state
Nothing is required. Optional: correct the two assertions above and run the described CTest target.
631e888 to
baaff39
Compare
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
Changes are required before merge: correct the top-level security error expectations so the new test matches the current API behavior.
What I ran
Reviewed head baaff3958114378bec2f4be6694048daeabc5d73 using repo_read.py against the prepared diff and pinned repository files. No commands or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed files | passed | Both changed files read |
| Targeted behavior audit | passed | Compared test expectations with implementation |
| CTest | not run | No test execution available |
Findings
Blocking
- The new test expects
ENOENTforsysctlbyname("security")andsysctlbyname("security.")atcore/libs/tests/GuestKernelSysctlSecurityNodes.cpp:146andcore/libs/tests/GuestKernelSysctlSecurityNodes.cpp:150. The implementation trims a trailing dot and returnsEINVALfor a top-level sysctl name, so these assertions fail. Update the expectations to match the established behavior, or change the implementation ifENOENTis the intended contract.
Non-blocking
None.
Not verified
- The submitted CTest command was not run.
- No excluded files were listed. Read both files marked
changedin the manifest:core/libs/prx/libkernel/CMakeLists.txtandcore/libs/tests/GuestKernelSysctlSecurityNodes.cpp. - No other files were read.
To get this to a good state
Correct the two top-level security error expectations and run ctest --test-dir build -R guest_kernel_sysctl_security_nodes_tests on the updated head.
|
Replying to MarcZX10's change request: the two top-level "security" assertions (ENOENT for "security" and "security.") are not failing. On this head the Windows job ran guest_kernel_sysctl_security_nodes and it passed (Test #6230, 0.04 s), so the implementation returns ENOENT there, not EINVAL. Linux CI was skipped on this head; PrivacyOnion's run is the Linux evidence. Passing on this head. Nit for the author: add the missing include for std::string. |
# Conflicts: # core/libs/prx/libkernel/CMakeLists.txt
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head 8fcde7650130f006cb334101c0fa76e16bdd986e. No test commands were run.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | Both changed files read |
| Reported CTest | not run | Description reports it; not independently verified |
Findings
Blocking
None.
Non-blocking
- The new test defines several errno constants and includes
<algorithm>without using them. Consider removing the unused declarations and include to keep the test focused.
Not verified
The reported CTest result, build behavior, and runtime behavior were not independently verified. Both changed files listed in the manifest were read; no files were excluded by the manifest.
To get this to a good state
Nothing is required.
Optional: remove the unused declarations and include.
# Conflicts: # core/libs/prx/libkernel/CMakeLists.txt
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
Changes are required before merge: address the optional test quality points below before treating this audit as complete.
What I ran
Reviewed head be3b652d64ba9ad6f2dba901d2f7c466ed5d92bb against base main. No build or test command was run; the test result in the PR description is author-reported. I read all changed lines in core/libs/prx/libkernel/CMakeLists.txt and core/libs/tests/GuestKernelSysctlSecurityNodes.cpp, plus the targeted SystemConfiguration.cpp implementations and the existing sysctl memory-node test for context.
Results
| Check | Result | Note |
|---|---|---|
| Changed-line review | passed | Both changed files read |
| Test execution | not run | Reported by author only |
| Runtime behavior | not verified | No build or execution performed |
Findings
Blocking
None.
Non-blocking
core/libs/tests/GuestKernelSysctlSecurityNodes.cpp:12-17:PosixEperm,PosixEnomem, andPosixEnotdirare unused. Remove them so the test does not carry stale errno expectations.core/libs/tests/GuestKernelSysctlSecurityNodes.cpp:190-200:Throwsaccepts anystd::exception, making the assertions pass for unrelated exception types. Check the expected exception type or otherwise assert its diagnostic so these cases verify the intended unsupported-write and unsupported-MIB paths.core/libs/tests/GuestKernelSysctlSecurityNodes.cpp:216-225: null-pointer cases also only check that some standard exception was thrown. Assert the expectedstd::invalid_argumentto ensure the API's documented null-argument path is what the test covers.
Not verified
The CTest run, build configuration, and runtime behavior were not verified. files.json was not provided as a readable artifact; the review manifest lists two changed files, and both were read in full. No excluded files were listed in the artifacts available to this review.
To get this to a good state
Nothing is required. The three points above are optional test-quality feedback.
ligmaSec
left a comment
There was a problem hiding this comment.
Built the exact branch test source and ran GuestKernelSysctlSecurityNodes on Linux against the existing runtime libraries. The test run passed and covered the security and jail nodes, bounds, and missing-name checks.
AI-assisted: yes.
What
Add non-GTest standalone test
GuestKernelSysctlSecurityNodes.cppverifying sysctl security and jail nodes, bounds, and ENOENT rejection in accordance with docs/dev/debt/libkernel.md.Tested
ctest --test-dir build -R guest_kernel_sysctl_security_nodes_tests
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)