Repository navigation
Conversation
…sterService sm's TIPC clients on a Switch 2 send RegisterService and UnregisterService with a service space ahead of the name, 20 and 12 bytes, and RegisterService puts max_sessions before is_light, where CMIF has is_light first. sm.swipc declares the CMIF layout only, so the generated dispatcher read the wrong fields. sm.c gets a dispatcher of its own. For those two TIPC commands it reads the 16 and 20 byte RegisterService forms and the 8 and 12 byte UnregisterService forms, and refuses any other size, buffer, X descriptor, C list or handle, as the SDK's TIPC command format does. The runtime serves one service space, so the space is logged and otherwise ignored. The CMIF forms stay the generated dispatcher's. The dispatcher joins the file's save-state table. Verified with sm_service (144 checks), which drives the dispatcher with both forms and checks the name, max_sessions and is_light it decodes, and that a wrong size or a descriptor is refused. runtime_architecture passes with the new save-state entry.
VIGO-VI
marked this pull request as ready for review
November 20, 2026 15:45
xinitrcn1
approved these changes
Nov 20, 2026
xinitrcn1
self-requested a review
November 20, 2026 19:05
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.
sm's TIPC clients send
RegisterServiceandUnregisterServicewith a service space ahead of the name on a Switch 2, 20 and 12 bytes, andRegisterServiceputsmax_sessionsbeforeis_light, where the CMIF form hasis_lightfirst.sm.swipcdeclares the CMIF layout only, so the generated dispatcher read the wrong fields. CI, run44756692206with main merged: every job passed, Windows (x86-64 and aarch64), Android, Recompiler, Linux AppImage (x86-64, with the native and sanitizer suites, and aarch64) and macOS. This pull request is ready for review.Part of #2224.
sm.cgets a dispatcher of its own. For those two TIPC commands it reads the 16 and 20 byteRegisterServiceforms and the 8 and 12 byteUnregisterServiceforms. Any other raw size, and any buffer, X descriptor, C list or handle, is answered as a request the command cannot take, as the SDK's TIPC command format checks the message's counts against the command's. The runtime serves one service space, so a space is logged and otherwise ignored, as the SM proxy of the public CFW does. The CMIF forms stay the generated dispatcher's, and the results are unchanged (NotAllowed for a registration, NotRegistered or NotAllowed for an unregistration).The layouts are Atmosphère's
UserService::RegisterService(OutMoveHandle, ServiceName, u32 max_sessions, bool is_light)andUnregisterService(ServiceName)serialized by its TIPC command format, and libounce's SM client with the space first.Testing:
sm_servicepasses with 144 checks. It drives the dispatcher with both TIPC forms and checks the name,max_sessionsandis_lightit decodes, that a wrong size and each descriptor or handle are refused, and that a name sm refuses is InvalidServiceName in either form.runtime_architecturepasses with the dispatcher in the file's save-state table.sm_servicepasses under ASan and UBSan with leak detection (build/san,SNX_TEST_SANITIZERS=ON).Not tested:
RegisterClientandGetServiceHandleonly in the runs made here (31 requests over the three, none forRegisterServiceorUnregisterService), so their logs prove the other commands and no regression, not these forms. The layouts come from the reference's serialization.Part of #2224.
SPDX-License-Identifier: GPL-3.0-or-laterand the project's copyright line.docs/CREDITS.md.