Skip to content

refactor(http): drop errno saves around guest copies - #26188

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
LeandroLP23:refactor/http-guest-copy-errno
Nov 23, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
LeandroLP23:refactor/http-guest-copy-errno

Conversation

@LeandroLP23

Copy link
Copy Markdown
Contributor

What

Same change as #25937, #25944 and #25945, for libSceHttp. GuestCopyIn_nid_no_patch, GuestCopyOut_nid_no_patch and GuestWritable_nid_no_patch restore errno themselves since #21243 (RestoreErrno in libc/src/General.cpp), so saving and restoring errno around them does nothing.

  • 14 inline saves around a guest copy are removed, in Client.cpp, Cookies.cpp, Parse.cpp, Uri.cpp and GuestAccess.hpp.
  • HttpGuest::CopyIn and HttpGuest::CopyOut in GuestAccess.hpp, and WriteGuestBytes in Uri.cpp, only wrapped the copy in such a save. They are removed, and their callers in GuestAccess.hpp, Cookies.cpp and Uri.cpp call the copy function directly, with the same arguments. HttpGuest::CopyText and the typed helpers stay.
  • A save is kept where the saved value is used again later in the function.

61 lines removed and 16 added. Export.cpp is left out because #9834, #11134 and #24528 change it.

No change in behaviour.

Tested

Windows 11 (10.0.26300), WinLibs GCC 15.2.0 r7, Release. ctest -R 'http', with its 34 build outputs from tools/select_tests.py targets: 50 of 50 on main 709342e209 and 50 of 50 with this change applied to it. tools/check_conventions.py passes. tools/pr_overlap.py --branch finds no overlap with the 2547 open pull requests.

Not run: Linux and macOS.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the prx label Nov 23, 2026

@mihiii1337 mihiii1337 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.

I ran a focused native Windows GCC 15.2 A/B test on 709342e and 6f10424 with the real libc guest-memory hooks deliberately overwriting errno. Both revisions passed with 56 read and 41 write hook calls. A cached client read to a read-only output threw without moving the client offset or changing errno, and retrying into writable memory returned the same first two bytes. The status-line parser preserved errno both on success and on rejecting a read-only status-code output. URI escaping and the local cookie set/get and stats paths also returned the expected results without leaking hook errno.

The client cache was seeded in the fixture, so the test opened no connections. It built the changed HTTP sources against cached libc whose checked-copy and guest-hook sources match both revisions.

AI-assisted: yes

@oneandonlydean
oneandonlydean merged commit aeed683 into boykopovar:main Nov 23, 2026
14 checks passed
@LeandroLP23
LeandroLP23 deleted the refactor/http-guest-copy-errno branch November 23, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants