Skip to content

feat(libSceGnmDriver): export the retail resource registration calls CUSA12982 imports - #1916

Open
Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/28088
Open

Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/28088

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#28088, originally opened by leskal.

Source commit: 208f9c6fc651d38fc1c9d23cc3f9167f2b404f92. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


What

CUSA12982 failed to link: it imports 31 functions from libSceGnmDriver that only libSceGnmDriverForNeoMode exported. Open PRs already add 14 of them to libSceGnmDriver: boykopovar#27342 the two compute waits, sceGnmGetPhysicalCounterFromVirtualized and sceGnmLogicalTcaUnitToPhysical, and boykopovar#27937 the ten validation calls. This PR adds the other 17, the resource and owner registration calls, as _nid_disambig1 copies like the functions the two modules already share:

  • sceGnmRegisterOwner and the 16 other registration calls return 0x8EEE00FF without reading their arguments, the value NeoMode returns for them and that shadPS4 returns as not available in retail firmware; recorded under Silent stubs

CUSA12982 needs this, boykopovar#27342, boykopovar#27937 and boykopovar#28089.

Tested

Windows 10, WinLibs GCC 15.2.0 r7: guest_gnm_driver passes with the new registration checks. With these 17, the other 14 and the libSceVideoRecording imports in one build, CUSA12982 links, starts, loads its pak files and later stops on an unrelated app0.zar directory read.

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: CUSA12982
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Compatibility
    • Added recognition for 17 additional Gnm driver resource and owner registration calls.
    • These calls currently return an unavailable error; resource registration and queries are not performed.

…CUSA12982 imports

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: GNM resource APIs

Layer / File(s) Summary
Declare and implement resource APIs
core/libs/prx/libSceGnmDriver/include/Api.hpp, core/libs/prx/libSceGnmDriver/Export.cpp
The API declarations cover resource registration, queries, metadata, and user-data access. The corresponding exported functions return Failure.
Test and document return values
core/libs/tests/GuestGnmDriver.cpp, docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
The guest test checks the reported return value for the resource APIs and is called from main. The debt note describes the calls, their stated behavior, and the import source.

Change: Feature

Merge Risk: Minimal · up to 208f9

This change adds exported stubs for GNM resource registration calls so that titles importing them can link. The stubs return the same unavailable-in-retail error code as the NeoMode library. No concrete problem was found, so merge risk is minimal.

Security architecture risk: Minimal · up to 208f9

libSceGnmDriver lets guest titles resolve the new imports without enabling resource registration or queries. Every new call returns the same failure code without reading guest arguments, exposing resource data, or changing ownership. No material security or rollback risk was identified in this change.

Security review details

Security Blast Radius

  • inferred — The added reachability is available to any guest that can resolve these imports in libSceGnmDriver, not just CUSA12982. That reachability ends at the failure return: the new bodies expose no resource metadata and grant no resource or ownership authority.

Trust Boundaries and Controls

  • observed — The new guest-to-library calls do not use guest-supplied pointers or identities. Even the owner registration functions deny the operation unconditionally rather than relying on an ownership check or passing a request downstream.

Rollout and rollback

  • inferred — The library version determines whether these imports resolve; the resource operations fail in the new version regardless of caller. Rolling back to the merge-base implementation removes the added symbols, so titles that require them lose that linkage. The stubs create no resource state for operators to migrate or clean up.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 4
  • Waived: $1.00 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16dede90-977a-4e62-addc-9fa3c63e3715
Commits

Reviewing files that changed from the base of the PR and between 4131f51 and 208f9c6.

Files selected for processing: 4

  • core/libs/prx/libSceGnmDriver/Export.cpp
  • core/libs/prx/libSceGnmDriver/include/Api.hpp
  • core/libs/tests/GuestGnmDriver.cpp
  • docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 1 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 4 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 5 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 6 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 7 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 8 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 9 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 10 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 11 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 12 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 13 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 14 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 15 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 16 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 17 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 18 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 19 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
PR 20 docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md

Exports with a name or library/NID already present in main:

  • sceGnmFindResourcesPublic (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetOwnerName (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceBaseAddressAndSizeInBytes (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceName (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceShaderGuid (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceType (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceUserData (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmQueryResourceRegistrationUserMemoryRequirements (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmRegisterGdsResource (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmRegisterOwner (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmRegisterOwnerForSystem (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmRegisterResource (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmSetResourceRegistrationUserMemory (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmSetResourceUserData (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmUnregisterAllResourcesForOwner (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmUnregisterOwnerAndResources (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmUnregisterResource (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)

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

Labels

unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants