Skip to content

fix(libkernel): query peers of libSceNet sockets - #18472

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
THEMANnt:fix/libkernel-getpeername-sce-net
Nov 12, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
THEMANnt:fix/libkernel-getpeername-sce-net

Conversation

@THEMANnt

Copy link
Copy Markdown
Contributor

What

Allow POSIX getpeername to query descriptors owned by libSceNet. Hold the registered socket owner through the native query and use the existing guest address and length copy path.

Tested

Windows x64, GCC 15.2. Built libkernel and libSceNet. The existing guest_sce_net_kernel_forwards test now checks both providers, the returned loopback address and EFAULT on a null address. It passed with local loopback access. Repository conventions passed. No title run.

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
  • 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 11, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 7dd13f1cc4, merged onto main f57c971559 (7dd13f1cc4, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_sce_net_kernel_forwards passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

@THEMANnt

THEMANnt commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Windows CI passed. Both macOS pipe-write jobs fail at link time because the shared test fixture is missing NotImplementedAt_nid_no_patch. Both proposed fixes, #17962 and #18375, passed on Intel and Apple Silicon macOS. Merging either PR is sufficient to fix the linker failure. I’ll rerun CI once the first one lands in main.

@github-actions

github-actions Bot commented Nov 11, 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 17603 core/libs/prx/libkernel/Socket/src/Udp.cpp L1943-1946

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.

Pull request Shared files not compared
PR 7088 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 11896 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 12682 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 12688 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 12700 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 12965 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 18197 core/libs/prx/libkernel/Socket/src/Udp.cpp

@gabichuuuuu

Copy link
Copy Markdown
Contributor

Windows check of head 7dd13f1cc4, merged onto main 28237a8567 (clean merge, built together with other open PRs that touch different files).

Setup: Windows 11 x64, WinLibs GCC 15.2.0 (r7), Ninja, Release, BUILD_TESTING=ON, Python 3.15.

  • Tests built from this PR's test files: guest_sce_net_kernel_forwards.
  • All of them pass in 3 of 3 runs.
  • Negative control: with this PR's code reverted to main (files it adds removed) and rebuilt, guest_sce_net_kernel_forwards fails in 2 of 2 runs, so the tests detect the change.

AI-assisted: yes.

@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 — no blocking findings

The change at head 7dd13f1cc4cc7bd12c246380c0a180d84d10c905 lets getpeername answer for libSceNet descriptors, and the code I read supports that. I did not build or run anything.

What I ran

  • Head SHA: 7dd13f1cc4cc7bd12c246380c0a180d84d10c905.
  • Read description.md, commits.md, manifest.json, diff.patch and files.json in the run folder.
  • Read at head with the reader: Udp.cpp lines 1880–1960, Socket.cpp lines 195–225, GuestNetKernelForwards.cpp lines 110–150, and the name searches for KernelFindSocketNative_nid_no_patch.
  • No build, no test run, no merged-preview check.

Results

Check Result Note
Diff read in full passed 2 files, 19 changed lines
Changed code read at head passed Both changed files
Build and tests not run Author reports a Windows x64 run
Repository conventions not run Author reports a pass
Comments in added code passed None added

Findings

Blocking

None.

Non-blocking

None that I can cite with a concrete defect.

Sources

  • Udp.cpp change: the owner is held for the native call; the forwarded path never reads socket.
  • Native lookup: returns the owner and native handle, or false.
  • Test additions: peer address and null-address EFAULT for both providers.

Not verified

  • The build on any platform, and the test run the author reports (Windows x64, GCC 15.2).
  • The Linux and POSIX path of the test on this head.
  • The repository conventions check the author reports as passed.
  • The GuestSockets::IsOpen body, which I only saw as a declaration in SocketRuntime.hpp.

To get this to a good state

No change is needed from the author for this review. Keep the Windows run output with the PR. No command needs rerunning on a new head unless the code changes.

@THEMANnt
THEMANnt force-pushed the fix/libkernel-getpeername-sce-net branch from 7dd13f1 to 9682b04 Compare November 12, 2026 16:12
@oneandonlydean
oneandonlydean merged commit 48007e7 into boykopovar:main Nov 12, 2026
14 checks passed
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.

5 participants