Skip to content

fix(libSceNet): refuse resolver timeouts below one second as firmware 13.42 does - #13850

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
zaryabzip:fix/net-resolver-timeout-range
Nov 1, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
zaryabzip:fix/net-resolver-timeout-range

Conversation

@zaryabzip

@zaryabzip zaryabzip commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What

sceNetResolverStartNtoa now refuses a timeout from 1 to 999999 with EINVAL, before the resolver is looked up. A timeout of 0 is still accepted, since the module replaces it with 1000000.

This is what @BunnyFl found running firmware 13.42's module:

  • Timeouts 1 and 999999 were refused.
  • Timeouts 1000000, 5000000 and 0x7fffffff went on to the resolver check.

That comment noted the rule wasn't modelled on #9727, and main still refused only negative timeouts. The rejection sits on the line that already returns EINVAL for a negative timeout or retry and for unknown flag bits, so the order among them doesn't matter.

The debt entry gains a sentence on the rule. It still says that the timeout and retry count aren't applied to the host lookup. The same comment's note on null hostname and address order after the resolver check isn't fully specified for a valid id, so it's left alone. No function changes count.

GuestSceNet.cpp checks, on a destroyed resolver:

  • timeouts 1 and 999999 fail with EINVAL;
  • 1000000 and 0x7fffffff reach the unknown-resolver EBADF.

Tested

Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), both with the head ce09309 merged into main beb7ce3.

  • No warnings in Export.cpp or GuestSceNet.cpp.
  • ctest -R "guest_sce_net|guest_net": 14 of 14 pass on both hosts. guest_sce_net passes 3 of 3 on --repeat until-fail:3; it needs no network.
  • Baseline: on that main with only the test change, guest_sce_net builds and then aborts at the timeout-1 row (line 685), where main reaches the unknown-resolver EBADF (Windows exit 0xc0000409, Linux SIGABRT).
  • tools/check_conventions.py passes. Rechecked on reopening against main ca073ec, which hasn't touched these files since the tested base: git merge-tree merges this cleanly with it and with every open pull request that merges with it, and no open pull request touches sceNetResolverStartNtoa.

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 (Claude Code)

… 13.42 does

sceNetResolverStartNtoa refuses a timeout from 1 to 999999 with EINVAL
before the resolver is looked up, and takes 0 as 1000000, as a run of
firmware 13.42's module shows.
@zaryabzip

Copy link
Copy Markdown
Contributor Author

Closing for now to stay within the 20-open-PR limit (#13848 was closed by it). The branch and its Windows/WSL2 results stay as they are, and I'll reopen this once one of my open pull requests is merged or closed.

@zaryabzip zaryabzip closed this Oct 31, 2026
@zaryabzip zaryabzip reopened this Oct 31, 2026
@zaryabzip

Copy link
Copy Markdown
Contributor Author

Reopened now that #13671 has merged. Rechecked against main ca073ec, which hasn't touched these files since the tested base: it merges cleanly with main and every open pull request, so the Windows and WSL2 results stand.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

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 5836 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 9932 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 12682 core/libs/prx/libSceNet/Export.cpp
PR 12688 core/libs/prx/libSceNet/Export.cpp
PR 12700 core/libs/prx/libSceNet/Export.cpp
PR 12965 core/libs/prx/libSceNet/Export.cpp
PR 14212 docs/dev/debt/libSceNet.md

@adriadam10 adriadam10 self-assigned this Nov 1, 2026
@adriadam10
adriadam10 merged commit 3c3f38b into boykopovar:main Nov 1, 2026
25 of 26 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the diff against @BunnyFl's 13.42 rows: timeouts 1 and 999999 now fail with EINVAL, 0 still maps to the default, and 1000000 / 0x7fffffff reach the unknown-resolver EBADF. The new rows in CheckRejectedArguments fail without the change (timeout 1 would return EBADF), and the debt entry matches the code; merged.

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.

2 participants