fix(libkernel): _umtx_op operation 27 returns 0 like the console #17887
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17887"
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 AasishDairelSahayaGrinspan on 2026-11-09T20:47:31Z.
What
A payload process on a PS5 (firmware 13.40) got 0 from
_umtx_opwith operation 27, as the _umtx_op entry of the technical debt records; this implementation failed withEINVALbecause 27 sits atUMTX_OP_MAXand the range check rejected it before the switch. Operation 27 now returns 0 without reading its arguments, as the measurement shows. What operation 27 does with valid arguments is unmeasured; the debt entry keeps that gap.The guest test
guest_umtx_oppinned the oldEINVAL; it now pins operation 27 returning 0 and adds operation 28 failing withEINVAL, so the upper bound stays guarded.Tested
macOS 15 (arm64, x86_64 target via Rosetta toolchain), Apple Clang, Release,
BUILD_TESTING=ON:ctest --test-dir build -R guest_umtx_op -V: passes, including the new operation 27 and 28 pins.python3 tools/check_conventions.py --base origin/main: passed.Windows and Linux were not compiled here; the change is one added
caselabel with no platform-dependent code, and CI covers them.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)Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-09T21:31:05Z.
Review: COMMENTED
Read at
784fefe681. The fix does what the description says. The range check sits indefault(SyncOnAddress.cpp:876), so the newcase UMTX_OP_MAXreturns 0 for operation 27 before reaching it.Two small points:
EINVALisn't measured. The_umtx_opdebt entry records the console measurement for 27 ("27 returns 0 on the console andEINVALhere") and nothing above it. So the newFailsWith(Umtx(&value, UMTX_OP_MAX + 1, 0), GUEST_EINVAL)pins a refusal the console was never seen to give. If 28 is a real operation there, the pin would be wrong in the same way the old 27 pin was. Either drop that line or note in the debt entry that 28 and above are unmeasured.case UMTX_OP_MAX:reads as "the out-of-range sentinel" next to theoperation >= UMTX_OP_MAXcheck below it. A named constant for 27 would make the intent clearer, for exampleUMTX_OP_MEASURED_NOOP = 27, or the FreeBSD name if Sony's numbering follows it. The test could then stop doing arithmetic onUMTX_OP_MAX.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-10T13:34:16Z.
Review: APPROVED
Approving
70bd6cc643. Both points are addressed:UMTX_OP_MEASURED_NOOPnames the measured no-op in both thecaselabel and the test, whileUMTX_OP_MAXstays the range-check bound.The op-28
EINVALpin is a host refusal rather than a measured console answer, but the entry now says so, and it guards the range check. That's a fair trade.AI-assisted: yes (Claude Code)