Repository navigation
feat(libkernel_sys): implement kmq_notify registration - #9302
DavidSamir wants to merge 20 commits into
Conversation
…sed and replaced ids
Progress report (0c6a5bd → c045c1e)📈 System libraries: 42.21% (+0.11%, +12 implemented, -7 removed functions) ✅ 12 implemented
🗑️ 7 removed
|
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Exports with a name or library/NID already present in
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.
|
…elative name An absolute host temp path is not mapped by the Linux guest resolver. Found by xXPBSXx on boykopovar#9097.
…lative name An absolute host temp path is not mapped by the Linux guest resolver. Found by xXPBSXx on boykopovar#9097.
The PS5 3.20 export lists have ksem_* in libkernel as well as libkernel_sys, and on Windows a libkernel import never reaches libkernel_sys, so titles importing them from libkernel did not find them. Following pipe1os's review on boykopovar#9284, also: ENOSPC from ksem_init when no descriptor is left, the SEM_MAX limit of 30 with ENOSPC, and dup/dup2 from a ksem id throwing as for a kqueue.
|
Linux: Ubuntu 24.04.1 LTS (WSL2), GCC 13.3.0, Release; head
Run from the PC (Windows host, Linux in WSL2), not from the PR author's machine. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
Nothing blocks this; the points below are optional.
What I ran
Reviewed head c045c1e91fe983f7e3e513692110e15b16470953 from the prepared diff and targeted source reads using repo_read.py. No build or tests were run; test results in the description are author-reported.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed-file inventory | passed | 12 changed files listed; all included |
| Queue notification logic | passed | Registration and consumption paths inspected |
| Build and tests | not run | Reported results were not independently verified |
Findings
Blocking
None.
Non-blocking
kmq_timedsend_nid_postfixconstructs its byte vector frommessageandmessage + lengthbefore locking. For a valid zero-length send withmessage == nullptr, formingmessage + lengthis undefined behavior. Handle the zero-length case without pointer arithmetic. (core/libs/prx/libkernel_sys/Mqueue.cpp:230)
Not verified
- Build, tests, and platform behavior were not run or independently confirmed. The description reports Windows 11 test runs.
- Read:
core/libs/CMakeLists.txt,core/libs/prx/libkernel/CMakeLists.txt,core/libs/prx/libkernel/Equeue/Equeue.cpp,core/libs/prx/libkernel/File/src/Stdio.cpp,core/libs/prx/libkernel/Semaphore/include/Ksem.hpp,core/libs/prx/libkernel/Semaphore/src/Ksem.cpp,core/libs/prx/libkernel_sys/CMakeLists.txt,core/libs/prx/libkernel_sys/Export.Discovery.cpp,core/libs/prx/libkernel_sys/Mqueue.cpp,core/libs/tests/GuestKernelSysKsem.cpp,core/libs/tests/GuestKernelSysMqueue.cpp,docs/dev/debt/libkernel.md, anddocs/dev/debt/libkernel_sys.md(changed hunks and relevant source ranges only). No changed paths were excluded bymanifest.json.
To get this to a good state
Nothing is required. The zero-length send edge case is optional feedback.
ligmaSec
left a comment
There was a problem hiding this comment.
kmq_notify retains the Open returned by Find, then locks the queue and publishes the numeric descriptor. Descriptor close can erase that Open and finish clearing the notifier between those steps. The queue can then retain a notification for a closed descriptor. Could registration recheck the descriptor identity under the same synchronization as close before publishing it? FreeBSD holds the descriptor table lock through that recheck and acquisition of the queue lock. FreeBSD registration code
Source review at c045c1e91f. The trial merge conflicts in kernel CMake, equeue and stdio.
AI-assisted: yes.
What
Builds on #9297 and implements
kmq_notifyregistration inlibkernel_sys/Mqueue.cpp, following FreeBSD 11sys/kern/uipc_mqueue.c(kern_kmq_notify,mqueue_send_notification). Until #9297 (and #9284 under it) merges, this PR's diff also shows their commits. This PR's own change is the last three commits.sigev_notifyother thanSIGEV_NONE,SIGEV_SIGNALorSIGEV_THREAD_IDgivesEINVAL, and for the two signal forms asigev_signooutside 1..128 givesEINVAL.EBADF, for a NULLsigeventas well.sigevent: removes only the calling descriptor's own registration; from another descriptor it does nothing and returns 0.EBUSY, even from the same descriptor.mqueue_senddoes.SIGEV_NONEis fully implemented.SIGEV_SIGNALandSIGEV_THREAD_IDregistrations throw, because delivering a guest signal with itssigev_valueis not modelled. A debt line records that.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release. This is a CPU-side export, so no GPU is involved.
guest_kernel_sys_mqueuegainsNotify():EINVALkind, includingEINVALwinning over a bad descriptor;EBADF, andEBUSYfrom both descriptors of the queue;kmq_notify_nid_postfix not implemented. On this branch it passes, 3 of 3 runs.guest_kernel_sys_ksemstill passes, andtools/check_conventions.pypasses.tools/pr_overlap.pycrashes on this machine's partial clone, so it was replaced by a check against an index of every open PR's diff plusgit merge-tree. This branch merges cleanly withmainand with feat(libkernel_sys): identify the initial pthread #9160, feat(libkernel_sys): implement uuidgen #9195, feat(libkernel_sys): implement wait3 and wait4 #9162, feat(libkernel): implement four pthread_attr forms #9156, feat(libkernel): implement getlogin #9171, feat(libkernel): implement pselect over select #9273, feat(libkernel): implement tcgetsid #9242, feat(libkernel_sys): implement the scePthread scope, atfork and setconcurrency forms #9141, feat(libkernel_sys): implement chown, lchown, fchownat and linkat #9103 and feat(libkernel_sys): implement the scePthreadBarrier, cpuclockid, concurrency and msync forms #8987.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)