feat(libkernel_sys): implement profil argument checks #11026
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11026"
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 Gruzzberry on 2026-10-25T14:25:25Z.
What
profilwas a throwing stub in libkernel_sys. FreeBSD 11.4'ssys_profilfails withEINVALwhenscaleis above1 << 16, stops profiling and returns 0 whenscaleis 0, and otherwise records the buffer and starts the profiling clock. It never reads thesamplespointer at call time; the clock does that on each tick.profilin libkernel_sys now returnsEINVALfor ascaleabove1 << 16and 0 for ascaleof 0 (profiling is never on, so there is nothing to stop). A non-zeroscalestill throwsNotImplemented_nid_no_patch, because the profiling clock that fills the sample buffer is not modelled. The declaration inApi.hppnow carries the real four arguments.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON.guest_kernel_sys:scaleof(1 << 16) + 1and0xFFFFFFFFgive-1withEINVAL;scale0 returns 0 with a null buffer and with the unreadable address0x10(the pointer is not dereferenced). Onmainthe test does not build against the stub, which takes no arguments; with this change it passes 3 runs out of 3. The non-zeroscalethrow is not asserted.main: the same tests fail on both under load (pr_overlap_encoding,public_headers,agc_import_settle_initial_dcc,agc_host_import_cut_lifetime,agc_driver_depth_plane_partial_store,audio_out2_timing,guest_job_manager_failures,guest_pthread_start,guest_pthread_rwlock,guest_select,guest_mutex_contention,guest_named_shm_windows_short_temp);guest_ampr_threadsfails intermittently on both (0 of 4 onmain, 3 of 4 here). No build failures on either.python tools/check_conventions.py --base upstream/main: passes.Overlaps
tools/pr_overlap.py: #9156 (neighbouring stub inExport.Discovery.cpp), #9389 (Export.cppL335) and #10421 (GuestKernelSys.cppL532). Proposed on each that it goes first and this PR rebases.swaponimplementation by mistake. That is removed;swaponis only in #11034.Checklist
main; no other open PR implements the same functionNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T14:31:22Z.
Review: DISMISSED
Requesting changes for an unrelated implementation included in this
profilPR. The diff also removes theswaponstub fromExport.Discovery.cpp, adds a four-argumentswapondeclaration, implements path validation and host filesystem checks forswaponinExport.cpp, and addsGuestEnotblk. None of this is described in the PR's What/Test sections, has no tests here, and is a separate API topic. This conflicts with the repository's one-topic-per-PR rule.Please remove the
swaponchanges from this branch; if that behavior is still wanted, submit it as a separate change after checking overlap and documenting/testing its contract. Theprofilportion itself follows FreeBSD 11.4's scale limit and scale-zero behavior (sys_profil): https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/kern/subr_prof.c#L1988-L2025. The local and hosted product jobs are skipped, so I have not independently run the reported Windows test.