Skip to content

test(libSceUserService): audit login user list parameter validation and boundary limits - #17478

Closed
slopgobblercobbler wants to merge 1 commit into
boykopovar:mainfrom
slopgobblercobbler:slopgobblercobbler/pr-libsceuserservice-login-bounds
Closed

slopgobblercobbler wants to merge 1 commit into
boykopovar:mainfrom
slopgobblercobbler:slopgobblercobbler/pr-libsceuserservice-login-bounds

Conversation

@slopgobblercobbler

@slopgobblercobbler slopgobblercobbler commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Verify sceUserServiceGetLoginUserIdList parameter validation by adding a null-pointer assertion (sceUserServiceGetLoginUserIdList(nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT) directly to GuestUserServiceLifecycle.cpp after initialization, resolving maintainer review feedback.

Tested

  • Built and ran conventions check: python tools/check_conventions.py --base upstream/main --head HEAD passed with 0 findings.
  • Verified GuestUserServiceLifecycle.cpp unit test assertions.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@JJenkx

JJenkx commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 26d501540c, merged onto main 0bae53facd (cf8d1ff666, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, Vulkan hidden for this CPU-only run. The linux check is skipped on this PR.

The PR does not build on Windows (MinGW GCC 15.2):

core/libs/tests/GuestUserServiceLoginBounds.cpp:20:58: error: 'USER_SERVICE_ERROR_INVALID_POINTER' was not declared in this scope; did you mean 'USER_SERVICE_ERROR_INVALID_ARGUMENT'?

I've only quoted the output here and haven't traced the cause.

AI-assisted: yes.

@gabichuuuuu gabichuuuuu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows run of head 26d501540c, merged onto main 095ff72367 in one tree with other open PRs that touch different files (each PR's test is its own file, so they don't interact). Setup: Windows 11, WinLibs GCC 15.2 r7 (x86_64-ucrt-posix-seh, the CI toolchain), Release, BUILD_TESTING=ON.

  • guest_user_service_login_bounds_tests does not compile on Windows: 'USER_SERVICE_ERROR_INVALID_POINTER' was not declared in this scope; did you mean 'USER_SERVICE_ERROR_INVALID_ARGUMENT'?. CI's Windows job builds the guest tests too, so this would fail there.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@slopgobblercobbler, this does not build and adds a whole test target for a single check. The title mentions partially filled lists, buffer boundaries and invalid user ids, but the only assertion is sceUserServiceGetLoginUserIdList(nullptr), and it expects USER_SERVICE_ERROR_INVALID_POINTER, which is not defined anywhere (JJenkx and gabichuuuuu both get the undeclared identifier error on Windows). The implementation in Export.cpp returns USER_SERVICE_ERROR_INVALID_ARGUMENT for a null pointer. core/libs/tests/GuestUserServiceLifecycle.cpp already covers the not initialized error, the OK case and the invalid entries. Could you drop the new file and the CMake block, and if you want the null pointer case, add one line to GuestUserServiceLifecycle.cpp after init that checks for USER_SERVICE_ERROR_INVALID_ARGUMENT?

@slopgobblercobbler
slopgobblercobbler force-pushed the slopgobblercobbler/pr-libsceuserservice-login-bounds branch from 26d5015 to af16d03 Compare November 19, 2026 23:43
@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

Thanks @oneandonlydean for the guidance!

Updated:

  1. Dropped the separate GuestUserServiceLoginBounds.cpp test file and its CMakeLists block.
  2. Added the sceUserServiceGetLoginUserIdList(nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT assertion directly to GuestUserServiceLifecycle.cpp after initialization.
  3. Rebased cleanly onto latest upstream/main and verified python tools/check_conventions.py --base upstream/main --head HEAD passes cleanly with 0 errors.

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head af16d03b7c, applied with git apply on main fd4aeed483 together with the other 29 PRs of one batch (#21223, #24030, #24201, #14202, #18889, #19531, #21641, #21773, #22468, #22471, #23239, #23255, #23484, #23869, #23992, #24311, #18425, #21195, #21255, #22989, #23507, #23886, #14582, #17878, #19666, #19899, #20138, #21656, #21746). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
guest_user_service_lifecycle (1 test, matched by name to the test file this PR changes) all pass outside the iGPU subset

Whole batch: the full ctest -j 12 (6522 tests) on the RTX 3080 has 4 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. The 2125 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

This was referenced Nov 21, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The null-pointer assertion matches the existing login-list validation behavior and is placed after service initialization.

What I ran

Reviewed head af16d03b7cf0f5a309fb67bae2a4cff1b7fbae94. I inspected the prepared diff, the changed test context, and repository search results. I did not run tests or the author-reported conventions check.

Results

Check Result Note
Diff and test context passed Assertion checks initialized service behavior
Automated checks not run Conventions check reported by author only

Findings

Blocking

None.

Non-blocking

None.

Not verified

No test suite or conventions check was run during this review. GuestUserServiceLifecycle.cpp was read; files.json was not available in the prepared bundle, so excluded files could not be confirmed. The manifest lists one changed file, and its full text was included.

To get this to a good state

Nothing is required.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing because main already checks this: sceUserServiceGetLoginUserIdList(nullptr) returning the invalid argument error after init is covered in GuestUserServiceLoginList.cpp, GuestUserServiceProfilesBounds.cpp and GuestUserServiceMultiLoginEventBounds.cpp. Please reopen if there is a case those miss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants