Repository navigation
fix(libSceVoiceQoS): guard local endpoint attribute guest inputs - #20378
Merged
oneandonlydean merged 1 commit intoNov 15, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
PrivacyOnion
approved these changes
Nov 15, 2026
PrivacyOnion
left a comment
Contributor
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 12b92f3dbb:
- Conventions:
tools/check_conventions.pypassed;git diff --checkclean. - Build:
guest_voice_qos_testsbuilt cleanly. - CTest (
guest_voice_qos,guest_voice_qos_app_type_0x10000000):1/2 Test #4705: guest_voice_qos_app_type_0x10000000 ... Passed 0.03 sec 2/2 Test #4704: guest_voice_qos ....................... Passed 0.02 sec 100% tests passed, 0 tests failed out of 2 - Negative control: with
core/libs/prx/libSceVoiceQoS/Export.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/2 Test #4704: guest_voice_qos .......................***Exception: SegFault 0.52 sec 2/2 Test #4705: guest_voice_qos_app_type_0x10000000 ...***Exception: SegFault 0.60 sec 0% tests passed, 2 tests failed out of 2 - Code reading:
- core/libs/prx/libSceVoiceQoS/Export.cpp: verified CopyIn safely copies caller values into local stack variables via GuestCopyIn_nid_no_patch and preserves errno, preventing host crashes on unmapped or invalid guest addresses such as 0x10.
- core/libs/prx/libSceVoiceQoS/Export.cpp: confirmed sceVoiceQoSSetLocalEndpointAttribute rigorously validates guest inputs (!value, localId != 0, attributeId < 0 || attributeId > 3, uncreated local endpoint, and size != 4 for selectors 0/2 or size != 1 for selectors 1/3) and returns SCE_VOICE_ERROR_LIBVOICEQOS_ARGUMENT_INVALID (0x804E0902) before any forwarding.
- core/libs/prx/libSceVoiceQoS/Export.cpp: checked selector dispatch logic, confirming that attributeId values 0 and 2 forward volume floats to sceVoiceSetVolume on inPort and outPort respectively, while attributeId values 1 and 3 forward mute flags to sceVoiceSetMuteFlag on inPort and outPort respectively.
- core/libs/prx/libSceVoiceQoS/Export.cpp: verified concurrency safety and lifecycle checks, ensuring Locked holds qos.mutex and checks initialization state (returning SCE_VOICE_ERROR_LIBVOICEQOS_NOT_INIT) across endpoint resolution, copy-in, and voice port manipulation without leaking locks or introducing races.
- core/libs/tests/GuestVoiceQoS.cpp: verified regression coverage for invalid pointer 0x10 across selectors 0, 1, 2, and 3, confirming that SCE_VOICE_ERROR_LIBVOICEQOS_ARGUMENT_INVALID is returned, errno preservation is asserted (Require(errno == 71)), and readbacks prove existing volume and mute states remain unaffected.
- docs/dev/debt/changes/fix-voiceqos-copy-in-local-attributes-w33.md: confirmed strict compliance with AGENTS.md, including zero added code comments, Conventional Commits PR title formatting, and accurate technical debt fragment logging for unmeasured console behavior on unreadable pointers.
Looks Good To Me
|
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
sceVoiceQoSSetLocalEndpointAttributeread caller-controlled values through rawfloat*anduint8_t*dereferences. A non-null but unmapped guest pointer, such as address0x10, crashed the host beforelibSceVoicewas called. The four supported selectors now use the existingGuestCopyIn_nid_no_patchmechanism to copy their four-byte volume or one-byte mute value into a local scalar before forwarding it. Copy failures return the existingSCE_VOICE_ERROR_LIBVOICEQOS_ARGUMENT_INVALID(0x804E0902) without changing a voice port, and the caller'serrnois preserved. Size, local endpoint, selector, and initialization checks retain their precedence; valid values still update the correct input/output voice port.The guest regression now calls all four selectors with an unreadable
0x10input, checks the return anderrno, and reads back each previously set value to confirm a rejected input does not change it. The technical-debt fragment documents that the console result for an unreadable non-null value is unmeasured; the existing error is a host-safety fallback.Overlap:
python tools/pr_overlap.py --names sceVoiceQoSSetLocalEndpointAttributeexamined 1,526 open PRs and found no competing implementation. The full branch scan examined 1,527 open PRs and failed closed on one stale, conflicting PR, #8656, whoseExport.cppandGuestVoiceQoS.cppare also modified. I inspected its patch: it changes connection-attribute storage,sceVoiceQoSSetConnectionAttribute, the two remote/connection attribute getters, and their tests. It includessceVoiceQoSSetLocalEndpointAttributeonly as unchanged hunk context, and does not add checked guest input handling or unreadable-value tests. The subject matter is independent, though the shared files could need a future rebase.Tested
core/libs/prx/libSceVoiceQoS/Export.cppwith-std=c++20 -O0 -g -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fsanitize=address,undefined -Wl,--gc-sections. Its test-only Linux guest-copy helper usesprocess_vm_readv, the same OS mechanism used by the library; controlled libSceVoice volume/mute callbacks record calls. On untouchedmain(905768a7, identicalExport.cpp/GuestVoiceQoS.cppto the rebased parent), the test aborts at the first invalid input: ASanSEGVreading0x10inExport.cpp:236, exit 134. With this patch, all four invalid-pointer selectors and the four valid-value checks pass under ASan and UBSan, exit 0. The harness is outside this PR.g++ -std=c++20 -fsyntax-only -I core/libspasses forcore/libs/prx/libSceVoiceQoS/Export.cppandcore/libs/tests/GuestVoiceQoS.cppseparately.git diff --checkpasses.python tools/check_conventions.py --base upstream/main: all checks pass. The branch uses the latest upstream main; the fork'sorigin/mainis older and produces unrelated errors if selected as the comparison base.python tools/debt_fold.py --root <isolated-copy-of-VoiceQoS-debt-and-fragment> --check. The globalpython tools/debt_fold.py --checkfails on preexistingdocs/dev/debt/changes/feat-icu-ulist.md, where[Older callable exports]matches twolibSceIcuentries, unrelated to this PR.BUILD_TESTING=ONconfiguration was attempted but could not complete:3rdparty/SDL2is an uninitialized submodule in this worktree, and the host lacks some SDL Linux development dependencies. The registeredguest_voice_qosCTests and title-level execution were therefore not run.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)