fix(libSceSdma): reject null and closed handles instead of dereferencing or throwing #16342
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16342"
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 MarcZX10 on 2026-11-06T10:12:14Z.
What
libSceSdmadereferenced its handle without checking it, and a command submitted on a closed handle ended in aNotImplementedthrow because a closed slot has a zero-sized ring.fix(libSceSdma): return an invalid-argument error for a null handle:sceSdmaClose,BeginQueueMode,CancelQueue,EndQueueMode,FenceNonBlocking,FlushAll,KickQueue,TryFlushand the sharedSubmitused by the copy and fill commands now returnSdmaErrorInvalidArgumentfor a null handle instead of dereferencing it.fix(libSceSdma): reject submissions on a closed handle:Submitreturns the same error when the slot is not open, so a blocking or non-blocking command on a closed handle no longer reaches the ring checks.testcommit after each fix inGuestSdma.cpp(RequireNullHandlecalls every handle entry point with a null handle;RequireClosedHandlecloses a handle and checks that fill and copy commands are rejected and the destination stays zero).docs(debt): record the unmeasured error code for null and closed handles: the code is0x80990005, the onesceSdmaOpenalready uses for bad arguments; no invalid-handle code is documented for this library and the console value for these cases is not measured.Tested
Linux, throwaway archive build of this head:
BUILD-EXIT 0, ctestguest_sdma(targetguest_sdma_tests) passed, 1 of 1.python3 tools/check_conventions.py --base upstream/mainandgit diff --checkare clean. The new cases were not run against the unfixed code; that they fail without the fixes is reasoned from the code (a null dereference, and a throw on the closed handle). Not run on Windows or macOS.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)