test(libkernel): cover null pointer precedence in ktimer_settime #14695
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14695"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by slopgobblercobbler on 2026-11-01T17:05:09Z.
What
Add negative test coverage in
core/libs/tests/GuestKernelSysKtimer.cppauditingktimer_settimenull pointer error precedence, verifying that a nullvaluepointer returns -1 with errno set toEFAULTtaking precedence over invalid timer IDs and flag arguments.Tested
Verified against conventions with
python tools/check_conventions.py --base upstream/main --head HEADwith 0 findings.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T20:45:56Z.
Review: COMMENTED
Reviewed — no blocking findings
The PR is titled as a test, but it also changes
ktimer_settime: invalid flags now return EINVAL where the base accepted them. That change matches what the libkernel debt entry for this export already describes. The title and the debt wording should say so. The new assertions were compiled on the hosted Windows job but not run.What I ran
e23b50f1970562e7f7f68f0f85196f655079af59; basef2d874c1fdccf781c0fa5d86619bb5dd8894b958. 2 files, +29/-0:Ktimer.cpp(+1) andGuestKernelSysKtimer.cpp(+28).ktimer_settimefunction (Ktimer.cpplines 119-135),TimerAbstime = 1(line 26), and the test's newSettimeNegativefunction.itimerspec(EFAULT) first, then flags (EINVAL), then the timer id (EINVAL). The test's expectations follow that order, including invalid ids with a null value (EFAULT).docs/dev/debt/libkernel.mdline 206 for this export lists EINVAL for "a baditimerspecfield, andTIMER_ABSTIME(1)". The new check is consistent with that list, but the entry does not say that every flag other thanTIMER_ABSTIMEis refused.guest_kernel_sys_ktimer_tests.exe, but its CTest run contains onlyconventions_ci_gate, and no step runs the guest binary. The relinker and linux jobs were skipped.Results
ktimer_settimeCommands and unedited precheck output
Commands:
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14695 --output-dir <scratch>/precheck/14695p(report.md in that directory).git fetch https://github.com/boykopovar/AnyPS5.git pull/14695/head.gh api repos/boykopovar/AnyPS5/commits/e23b50f1970562e7f7f68f0f85196f655079af59/check-runs; Windows log: the windows job of that run (one CTest case, then the guest binary listed without a run step).Precheck table (unedited):
The precheck deliberately does not configure, build, or compile AnyPS5.git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...e23b50f1970562e7f7f68f0f85196f655079af59/marc/DeusMachina_0x1914/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head e23b50f1970562e7f7f68f0f85196f655079af59 --title test(libkernel): cover null pointer and invalid flags in ktimer_settime --body /dev/shm/reviewer-run/precheck/14695p/pr-body.md/marc/DeusMachina_0x1914/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head e23b50f1970562e7f7f68f0f85196f655079af59 --jsonNo changed Python implementation files.No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.No changed test_*.py files./marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14695 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14695p/stackNot run: C++ tests need exact-head binaries, which require a build; the precheck does not build./marc/DeusMachina_0x1914/.venv/bin/python3 /dev/shm/reviewer-run/precheck/14695p/head-e23b50f19705-ac8bd8ce/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14695p/head-e23b50f19705-ac8bd8ce --json core/libs/prx/libkernel/Time/Ktimer.cpp core/libs/tests/GuestKernelSysKtimer.cppNo changed Python test module in tools/ can be run as a no-build base-source control.Negative control
Not run here. The guest test needs a build and a run.
Findings
Blocking
None.
Non-blocking
Ktimer.cppline 121 now returns EINVAL for any flag other thanTIMER_ABSTIME, where the base accepted all flags. Please retitle it as a fix and state the behaviour change in the "What" section.docs/dev/debt/libkernel.mdline 206 lists "TIMER_ABSTIME(1)" among the EINVAL conditions, which does not say that other flags are refused. Please state "flags other thanTIMER_ABSTIME(1)" so the entry matches the code.Sources
github.com/boykopovar/AnyPS5@e23b50f197/core/libs/prx/libkernel/Time/Ktimer.cpp (L119-L135)github.com/boykopovar/AnyPS5@e23b50f197/core/libs/tests/GuestKernelSysKtimer.cpp (L98-L124)github.com/boykopovar/AnyPS5@e23b50f197/docs/dev/debt/libkernel.md (L206)Not verified
ktimer_settimerefuses all other flags was not measured; the check follows the debt entry's cited FreeBSD behaviour, which I did not re-read.To get this to a good state