fix(libkernel_sys): safely probe the list and timeout of aio_suspend #20604
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20604"
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 milescoviello on 2026-11-15T10:56:27Z.
What
aio_suspendread the timeout with*timeout, then compared each queued job againstlist[index]straight through the guest pointer on every wake-up. An unmapped timeout, or an unmapped list while a job was queued, faulted the host.The list (at most 256 entries, the existing
countlimit) is now copied into a local array once withGuestCopyIn_nid_no_patch, and the timeout is copied into a localKernelTimespecthe same way, before the wait starts. This is also what FreeBSD'saio_suspenddoes: itcopyins the list and the timeout up front. An unreadable list or timeout fails withEFAULT, which is what the null list already returns here and whataio_waitcompletein the same file returns for an unreadable timeout. TheEINVALcount and timeout checks,EAGAINon timeout and the null-entry skipping are unchanged.The debt entry goes in a fragment under
docs/dev/debt/changes/and records this as unmeasured.Tested
Linux (Ubuntu 26.04.1), GCC 15.2, Release.
guest_kernel_sys_aio:0x10) returns -1 withEFAULT;EFAULT;{nullptr, &request}with a 5 ms timeout returns 0 for the completed request.The existing count, null-list, bad-timeout, cancel and timeout cases still pass.
Negative control: with
Aio.cppfrommain, the test segfaults with both new unmapped cases, and again with only the unmapped-list case.git merge-treeagainst the open PRs that touchAio.cppor the test (#18190, #18112, #16191, #13730): no conflicts.tools/check_conventions.pypasses on the branch and this body;tools/debt_fold.py --checkpasses with the fragment applied tomain.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)