kernel: implement libkernel_module_info module enumeration #2288

Open
github-bot wants to merge 1 commit from github-bot/gh-2288 into main AGit
Owner

@⁠saironbusatto on GitHub · 2026-11-15 15:56 UTC · original
saironbusatto:fix/ea-module-info → main · +115 −0 · 3 files · 1 commits · open

Game and problem

EA SPORTS UFC 6 (PPSA23566) and Madden NFL 26 (PPSA26127) call the libkernel_module_info library at startup. Kyty does not register that library, so the calls land on the unresolved-import stub, which returns zero. On Madden NFL 26 the game then keeps calling the stub repeatedly while frozen on the startup screen (Madden compat report, #1834); on UFC 6 the boot still proceeds.

While testing a local build, implementing sceKernelGetModuleList2 made UFC 6 immediately call sceKernelGetModuleInfo2 with the returned handle — both were unresolved stubs before, which confirms both are on the startup path of libkernel_module_info_v1 / libkernel_v1.1.

Cause

The two functions libkernel.sprx exports through the libkernel_module_info library are not implemented: sceKernelGetModuleList2 (ZzzC3ZGVAkc) and sceKernelGetModuleInfo2 (QgsKEUfkqMA).

Fix

Implement both over RuntimeLinker's loaded programs:

  • sceKernelGetModuleList2 fills the handle array from a new small RuntimeLinker::GetProgramIds() accessor, returns KERNEL_ERROR_ENOMEM when the loaded-program list does not fit num_array, and writes the loaded count to out_count.
  • sceKernelGetModuleInfo2 validates info->st_size (0x160 bytes), resolves the program by handle, and fills the PS5 ModuleInfo layout — name (so_name with a filename fallback, as in KernelGetModuleInfoForUnwind), up to four PT_LOAD segments with address/size/prot, segment_count, and a zeroed fingerprint. The layout is cross-checked against AnyPS5's SceTypes.hpp (static_asserts at 0x8/0x108/0x148/0x14C, size 0x160).

Signatures follow shadPS4's process.cpp (sceKernelGetModuleList2(s32* handles, u64 num_array, u64* out_count), sceKernelGetModuleInfo2(s32 handle, info*)).

Result

UFC 6 (PPSA23566) on Linux now boots with zero unresolved-import lines and reaches the menu. Tested on the same build with and without the change: before, Unresolved import stub called: ZzzC3ZGVAkc[libkernel_module_info_v1][libkernel_v1.1][Func] and, once the list function was added, QgsKEUfkqMA[...] too; after, none.

**@⁠saironbusatto** on GitHub · 2026-11-15 15:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2288) `saironbusatto:fix/ea-module-info` → `main` · +115 −0 · 3 files · 1 commits · open ## Game and problem EA SPORTS UFC 6 (PPSA23566) and Madden NFL 26 (PPSA26127) call the libkernel_module_info library at startup. Kyty does not register that library, so the calls land on the unresolved-import stub, which returns zero. On Madden NFL 26 the game then keeps calling the stub repeatedly while frozen on the startup screen ([Madden compat report](https://github.com/KytyPS5/kytyps5.github.io/blob/main/src/content/compat/madden-nfl-26-linux.md), #1834); on UFC 6 the boot still proceeds. While testing a local build, implementing `sceKernelGetModuleList2` made UFC 6 immediately call `sceKernelGetModuleInfo2` with the returned handle — both were unresolved stubs before, which confirms both are on the startup path of `libkernel_module_info_v1` / `libkernel_v1.1`. ## Cause The two functions libkernel.sprx exports through the `libkernel_module_info` library are not implemented: `sceKernelGetModuleList2` (`ZzzC3ZGVAkc`) and `sceKernelGetModuleInfo2` (`QgsKEUfkqMA`). ## Fix Implement both over RuntimeLinker's loaded programs: - `sceKernelGetModuleList2` fills the handle array from a new small `RuntimeLinker::GetProgramIds()` accessor, returns `KERNEL_ERROR_ENOMEM` when the loaded-program list does not fit `num_array`, and writes the loaded count to `out_count`. - `sceKernelGetModuleInfo2` validates `info->st_size` (0x160 bytes), resolves the program by handle, and fills the PS5 `ModuleInfo` layout — name (so_name with a filename fallback, as in `KernelGetModuleInfoForUnwind`), up to four `PT_LOAD` segments with address/size/prot, `segment_count`, and a zeroed fingerprint. The layout is cross-checked against [AnyPS5's `SceTypes.hpp`](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/SceTypes.hpp) (`static_assert`s at 0x8/0x108/0x148/0x14C, size 0x160). Signatures follow shadPS4's `process.cpp` (`sceKernelGetModuleList2(s32* handles, u64 num_array, u64* out_count)`, `sceKernelGetModuleInfo2(s32 handle, info*)`). ## Result UFC 6 (PPSA23566) on Linux now boots with zero unresolved-import lines and reaches the menu. Tested on the same build with and without the change: before, `Unresolved import stub called: ZzzC3ZGVAkc[libkernel_module_info_v1][libkernel_v1.1][Func]` and, once the list function was added, `QgsKEUfkqMA[...]` too; after, none.
EA titles enumerate loaded modules at startup through the
libkernel_module_info library (UFC 6, PPSA23566; Madden NFL 26,
PPSA26127). The unresolved stubs returned zero, so the game never
received valid module handles and immediately called into the next
missing import.

Implement sceKernelGetModuleList2 and sceKernelGetModuleInfo2 over
RuntimeLinker's loaded programs. The ModuleInfo layout (0x160 bytes,
name/segments/segment_count/fingerprint) is cross-checked against
AnyPS5's SceTypes.hpp. sceKernelGetModuleInfoFromAddr-style programs
keep the so_name/filename fallback.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:18:09 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-15 16:02 UTC · original

Explain Change →

Walkthrough

The change adds a RuntimeLinker method that returns loaded program IDs. It adds and registers libkernel functions to list module IDs and retrieve module names and load-segment details. The functions validate output pointers and structure size, and return errors for invalid inputs or unresolved module data.

Suggested reviewers: nmzik, ew-sudo

Change: Feature

Merge Risk: Low · up to ff152

This adds module-enumeration functions that EA titles call at startup. The author reports that UFC 6 reaches the menu with no unresolved imports. A narrow race remains if a module is unloaded while its info is being read. This is unlikely during normal startup. Fixing it is a small change and should be considered, but it does not look like a blocker.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: implementing the libkernel_module_info module enumeration functions. The raw summary shows the new sceKernelGetModuleList2 and sceKernelGetModuleInfo2 implementations,…
Description check Passed The description explains the game and the startup problem, the cause (two unimplemented functions in libkernel_module_info), the fix (implementations over RuntimeLinker programs, plus a new GetProgram…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: implementing the libkernel_module_info module enumeration functions. The raw summary shows the new sceKernelGetModuleList2 and sceKernelGetModuleInfo2 implementations, which match this title. The title is short and specific.

Full details: Description check

Explanation

The description explains the game and the startup problem, the cause (two unimplemented functions in libkernel_module_info), the fix (implementations over RuntimeLinker programs, plus a new GetProgramIds accessor), and the test result. It matches the changeset in libKernel.cpp and runtimeLinker files.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

**@⁠coderabbitai[bot]** on GitHub · 2026-11-15 16:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2288#issuecomment-6897292923) <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2288?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The change adds a `RuntimeLinker` method that returns loaded program IDs. It adds and registers libkernel functions to list module IDs and retrieve module names and load-segment details. The functions validate output pointers and structure size, and return errors for invalid inputs or unresolved module data. **Suggested reviewers:** `nmzik`, `ew-sudo` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"ff1529b634c66d4792fba7a76af4e244e12ed611" --> <!-- change_assessment_priority:{"version":1,"urgency":"p1","manual":false} --> **Change:** Feature <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong> · up to <code>ff152</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🔵 Low** · up to `ff152` --> <!-- final_review_risk_coverage:{"sourceCommitId":"ff1529b634c66d4792fba7a76af4e244e12ed611","coveredCommitId":"ff1529b634c66d4792fba7a76af4e244e12ed611","kind":"reviewed"} --> This adds module-enumeration functions that EA titles call at startup. The author reports that UFC 6 reaches the menu with no unresolved imports. A narrow race remains if a module is unloaded while its info is being read. This is unlikely during normal startup. Fixing it is a small change and should be considered, but it does not look like a blocker. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: implementing the libkernel_module_info module enumeration functions. The raw summary shows the new sceKernelGetModuleList2 and sceKernelGetModuleInfo2 implementations,… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description explains the game and the startup problem, the cause (two unimplemented functions in libkernel_module_info), the fix (implementations over RuntimeLinker programs, plus a new GetProgram… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the main change: implementing the libkernel_module_info module enumeration functions. The raw summary shows the new sceKernelGetModuleList2 and sceKernelGetModuleInfo2 implementations, which match this title. The title is short and specific. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description explains the game and the startup problem, the cause (two unimplemented functions in libkernel_module_info), the fix (implementations over RuntimeLinker programs, plus a new GetProgramIds accessor), and the test result. It matches the changeset in libKernel.cpp and runtimeLinker files. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2288)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end -->
@ -1821,0 +1873,4 @@
}
auto* rt = Common::Singleton<Loader::RuntimeLinker>::Instance();
auto* program = rt->FindProgramById(handle);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-15 16:02 UTC · original

Major · Stability & Availability · Quick win

Keep the loaded program alive while KernelGetModuleInfo2 reads it.

FindProgramById releases m_mutex before it returns the Program*. A concurrent UnloadProgram can then remove the program and free it through DeleteProgram while this function still holds the pointer. The reads at lines 1877-1909 can then access freed memory.

Read the required fields while the runtime linker lock is held. One way is a RuntimeLinker method that fills a caller-provided snapshot under m_mutex. Another way is a lookup that returns the needed values rather than the raw pointer.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-15 16:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2288#discussion_r4579121468) <!-- coderabbit-ai-generated:v1 --> **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/major-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Major** · **Stability & Availability** · **Quick win** **Keep the loaded program alive while `KernelGetModuleInfo2` reads it.** `FindProgramById` releases `m_mutex` before it returns the `Program*`. A concurrent `UnloadProgram` can then remove the program and free it through `DeleteProgram` while this function still holds the pointer. The reads at lines 1877-1909 can then access freed memory. Read the required fields while the runtime linker lock is held. One way is a `RuntimeLinker` method that fills a caller-provided snapshot under `m_mutex`. Another way is a lookup that returns the needed values rather than the raw pointer. <!-- fingerprinting:phantom:poseidon:wombat61 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:13d48ade54c032ff5210f4c3 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-15 16:02 UTC · original · reviewed

Actionable comments posted: 1

Additional comments: 1

src/libs/libKernel.cpp-1857-1858: 1

1857-1858: Minor · Data Integrity & Integration · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Write the loaded-module count before returning ENOMEM.

With three loaded modules and capacity one, this branch returns without updating out_count. A caller that initializes out_count to zero receives no required capacity for its retry. Assign count to *out_count before this branch.

The PR objective requires reporting the loaded-module count.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3acafb358f and ff1529b634.

Files selected for processing: 3

  • src/libs/libKernel.cpp
  • src/loader/runtimeLinker.cpp
  • src/loader/runtimeLinker.h

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-15 16:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2288#pullrequestreview-5911615613) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/message-square-off-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/message-square-off.svg" width="16" height="16" align="absmiddle" alt=""></picture> Additional comments: 1</summary><blockquote> <dl> <dd> <br> <details> <summary>src/libs/libKernel.cpp-1857-1858: 1</summary><blockquote> <dl> <dd> <br> `1857-1858`: **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/amber-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minor** · **Data Integrity & Integration** · **Quick win** <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg" width="20" height="20" align="absmiddle" alt=""></picture> **Unverified finding** Verification ran but could not confirm this finding. It is shown for review, not as a verified issue. **Write the loaded-module count before returning `ENOMEM`.** With three loaded modules and capacity one, this branch returns without updating `out_count`. A caller that initializes `out_count` to zero receives no required capacity for its retry. Assign `count` to `*out_count` before this branch. The PR objective requires reporting the loaded-module count. <!-- cr-comment:v1:319e042876925a1fe590c91b --> </dd> </dl> </blockquote></details> </dd> </dl> </blockquote></details> <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/3acafb358f5a136ed7b5ca847476c3ebb2c78750/.coderabbit.yaml>) - **Commit**: [3acafb3](<https://github.com/KytyPS5/KytyPS5/commit/3acafb358f5a136ed7b5ca847476c3ebb2c78750>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `27e48076-79fe-4929-920d-793f6b53931e` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 3acafb358f5a136ed7b5ca847476c3ebb2c78750 and ff1529b634c66d4792fba7a76af4e244e12ed611. </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 3</summary> <dl> <dd> <br> * `src/libs/libKernel.cpp` * `src/loader/runtimeLinker.cpp` * `src/loader/runtimeLinker.h` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=5e9340e6-ec82-45e8-8c90-b5c5fd760e39 attempt=d319d74e-477a-441c-acb9-90c777fd2c16 batch=1/1 -->
This pull request has changes conflicting with the target branch.
  • src/libs/libKernel.cpp
  • src/loader/runtimeLinker.cpp
  • src/loader/runtimeLinker.h
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2288/head:github-bot/gh-2288'
git switch 'github-bot/gh-2288'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2288'
git switch 'github-bot/gh-2288'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2288'
git switch 'github-bot/gh-2288'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2288'
git switch 'main'
git merge --squash 'github-bot/gh-2288'
git switch 'main'
git merge --ff-only 'github-bot/gh-2288'
git switch 'main'
git merge 'github-bot/gh-2288'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.