fix(libSceCdlgPlayerReview): keep a terminated dialog terminated during Open #15420
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15420"
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 XairRrR on 2026-11-03T06:48:50Z.
What
scePlayerReviewDialogOpen(core/libs/prx/libSceCdlgPlayerReview/Export.cpp) loads the status, checks it, validates the parameter, reads the login user list throughsceUserServiceGetLoginUserIdList, and then storesFINISHEDwith a plain assignment. If another thread callsscePlayerReviewDialogTerminatein that window, Terminate moves the status fromINITIALIZEDtoNONEand returns 0, and Open then overwritesNONEwithFINISHEDand also returns 0. After that,scePlayerReviewDialogGetStatusreportsFINISHEDfor a library that was terminated, and a followingscePlayerReviewDialogInitializefails with0x80B80004(ALREADY_INITIALIZED).Open now moves the status to
FINISHEDwith a compare-exchange loop that starts from the status it checked. If the status changed in the meantime, the loop checks it again and returnsNOT_INITIALIZEDforNONEorBUSYforRUNNING, as the first check does. A Terminate that wins therefore stays in effect.scePlayerReviewDialogCloseis not changed, because it only storesFINISHEDfromRUNNING, and no path in this library entersRUNNING.The same pattern is fixed for other dialog libraries in #12931 (HmdSetupDialog) and #12893 (NpSnsFacebookDialog). This PR does not depend on them.
Tested
Arch Linux 7.2.11-zen, GCC 16.2.1, Ninja, Release, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08).
core/libs/tests/GuestPlayerReviewDialog.cpp: 200000 rounds of Initialize on the main thread, then Open on the main thread racing Terminate on a second thread. After each round the status must beNONE.ctest --test-dir build -R '^guest_player_review_dialog$': 1/1 passed (0.06 s), 5 runs out of 5.Export.cpprestored fromorigin/mainand rebuilt, the test aborts on all 3 runs (1/1 Test #1893: guest_player_review_dialog .......Subprocess aborted***Exception: 0.08 sec). With a temporary print added at the new check, the failure wasround 9 status 3, so the status wasFINISHEDafter Terminate.cmake --build build --target libs: built.python3 tools/check_conventions.py --base origin/main:All conventions checks passed.git diff --check origin/main: clean.python3 tools/pr_overlap.py --branch auto/fix-libscecdlgplayerreview-terminate-race:No overlap with open pull requests.#12516 adds checks to the same test file in other places, and it merges cleanly with this branch.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 MarcZX10 on 2026-11-03T06:54:19Z.
Review: APPROVED
Reviewed — looks good
The compare-exchange loop prevents
Openfrom restoringFINISHEDafterTerminatehas already set the dialog toNONE, and the relevant Windows test passed on this head.What I ran
Reviewed head
eb3f9794b6856ec6571c20f9c11e8e89f94e74c7against based1ae628bc2f62459cce1e9872ba5632c938c71f2; the stack checker reports a clean preview against that base. Local inspection environment: Debian Linux x86_64, GCC 12.2.0 and Python 3.11.2. The hosted Windows workflow built and ran the changed test.Results
Precheck table and raw helper output
The precheck's ABI-helper error was:
The precheck's test-quality-helper error was:
The manual test-quality heuristic output was:
Manual ABI audit output summary:
Exact-head CMake registration output:
Pairwise merge preview output for #12516 and this head:
Hosted check status output on the reviewed head:
Windows workflow log, exact-head test output:
The overlap helper failed with:
Negative control
The PR description reports that restoring the old implementation makes the test fail on three runs, including one observed
FINISHEDstatus after termination. I did not independently run this build-based control. The no-build review cannot exercise the assertion against a binary.Findings
Blocking
None found in the inspected implementation and test.
Non-blocking
The race test checks the final status but discards
scePlayerReviewDialogOpen's return value. As an additional assertion, require the result to be either success orCOMMON_DIALOG_ERROR_NOT_INITIALIZED, the two outcomes consistent with the competing operations. The existing 200,000-round final-state assertion does cover the reported resurrection defect.Sources
scePlayerReviewDialogOpenNot verified
I did not run a local C++ build or CTest, or independently reproduce the base negative control. The hosted Windows workflow built the changed test and CTest passed 1/1 on this head; Linux and specialized jobs were skipped. The PR author separately reports five successful runs and three failing base-control runs.
To get this to a good state
No blocking change is required from this review. No change is required for approval. If a new head is pushed, I will inspect the new diff and rerun the applicable checks.