Repository navigation
Conversation
…is too large Queue() rejected a request whose nbytes exceeds INT_MAX with Fail(), which sets errno but never stores the error in the guest aiocb. The request keeps the status -1 and error 0 set at entry, so a following aio_error() reported the rejected request as completed without error. Use the local fail() helper, which records the error in the aiocb as the other rejection paths in Queue() already do.
…s rejected The validation test pinned the aiocb error to 0 for a request with nbytes above INT_MAX. Expect EINVAL there, as the other rejected requests do, and check that aio_error() reports the same error.
…st without a valid signo Queue() rejected a SIGEV_SIGNAL or SIGEV_THREAD_ID request whose signo is outside 1..SignalMax with Fail(), which sets errno but never stores the error in the guest aiocb. The request kept status -1 and error 0, so a following aio_error() reported it as completed without error. Use the local fail() helper, as the other rejection paths in Queue() do.
…ith signo 0 Expect EINVAL in the aiocb and from aio_error() when the signal notification has no valid signo, matching the other rejected requests.
8c10407 to
4b9daae
Compare
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
|
Hi @MarcZX10, Reviewed at 4b9daae. I think main's mix of
That is exactly what Could you point to a PS5-side source (a trace from real hardware, or a disassembly) showing that these two rejections write EINVAL into the aiocb? Without one, I'd keep main's behaviour and close this. |
gabichuuuuu
left a comment
There was a problem hiding this comment.
Read 4b9daae4af against main.
Correctness. The two Fail(GuestEinval) returns in Queue (core/libs/prx/libkernel_sys/Aio.cpp) are not an oversight: they reproduce FreeBSD 11.4 aio_aqueue_job (sys/kern/vfs_aio.c), which stores status = -1 and error = 0 on entry, then calls ops->store_error(ujob, ...) for the queue limit, the copy-in failure and a bad sigev_notify, but returns EINVAL without store_error for aio_nbytes > IOSIZE_MAX and for an invalid sigev_signo. FreeBSD's kern_aio_error then takes the "failure of aio_aqueue" path (fetch_status == -1) and returns the stored error, which is 0 for those two cases. So main's aio_error result of 0 for the oversized and bad-signal requests is the reference behaviour, and the huge.error == 0 assertion was pinning it on purpose, next to the notify.error == Einval assertion for the case where FreeBSD does store it. Switching both to fail makes AnyPS5 diverge from FreeBSD with no PS5 measurement given.
Test. The updated assertions fail on main (it leaves error at 0), so they exercise the change, but they encode the non-FreeBSD result. Unless there is console evidence that the PS5 kernel stores EINVAL here, this should stay as it is on main; if there is, cite it and add a libkernel_sys.md entry recording the departure from FreeBSD.
Not run here; this is from reading the code.
AI-assisted: yes.
|
Windows check of head Setup: Windows 11 x64, WinLibs GCC 15.2.0 (r7), Ninja, Release,
AI-assisted: yes. |
|
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.
|
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
|
No code change pushed on this PR yet. This is a decision for the author, because the review's objection depends on how PS5 behaves, not on the code alone. What I checked:
Options:
@MarcZX10 please pick one (or say which evidence you have). I will apply it on the fork branch, run Not verified by me: the test run (the PR reports one local run, which I did not reproduce) and the FreeBSD comparison. |
|
I am closing this for now. Recording EINVAL in the aiocb needs console evidence, or a libkernel_sys.md entry that cites it, and none has come in since 7 Nov. If you can measure it on the console, please reopen it with that and we will look again. |
What
Queue()incore/libs/prx/libkernel_sys/Aio.cpprejects two requests withFail(GuestEinval), which sets errno but does not store the error in the guestaiocb. The request is never queued, butstatusstays -1 anderrorstays 0 (set on entry), so a followingaio_error()reports the rejected request as completed without error. The other rejection paths in the same function go through the localfail()helper, which records the error in the aiocb.Affected checks:
nbytes > INT_MAX: fixe3cebfb6a2, testdd23eece9dSIGEV_SIGNAL/SIGEV_THREAD_IDwithsignooutside1..SignalMax: fix2ce12e4318, test8c10407b0eThe fix only changes the two
returnstatements tofail(GuestEinval). The call still returns -1 with EINVAL; the aiocb now carries the same EINVAL thataio_error()reports.The existing validation test asserted
huge.error == 0for the oversized request, which pinned the defect; it now expects EINVAL.Overlap and interaction: open PR #14403 adds a copy-in line directly above the
nbytescheck inQueue(). It does not change the lines this PR changes, but the hunks are adjacent. Merging this branch with #14403 produces a textual conflict incore/libs/prx/libkernel_sys/Aio.cpp(checked withgit merge-tree). This PR does not depend on #14403 and is based onupstream/main. #15115 touchesaio_suspendand is not affected.Tested
Linux host (kernel 6.1), throwaway archive build with the CPU startup gate patched.
guest_kernel_sys_aio(guest_kernel_sys_aio_tests) on the fixed head8c10407b0e: build exit 0, 1/1 passed.check failed at line 91(thenbytescase), as expected.python3 tools/check_conventions.py --base upstream/main: passed.git diff --check upstream/main: clean.tools/pr_precheck.py(no-build): conventions and ABI audit passed; build-dependent C++ tests reported not run by that tool, which the build above covers.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)