feat(libSceNet): support IPv6 dual-stack socket options #10949
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10949"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by AZLisme on 2026-10-25T11:20:02Z.
What
sceNetSetsockoptandsceNetGetsockoptsupport IPv6-levelIPV6_V6ONLYthrough the shared option backend, including IPv4-mapped TCP/UDP traffic on dual-stack sockets. The contract follows FreeBSD 11.4 ip6_ctloutput; console verification and the existing null-buffer policy remain debt.Address the guest-output review by staging IPv6 readback and opening
GuestArena::HostWritefor exactly the bounded option bytes and the full length output before either caller buffer is modified. A rejected guard returns guestEFAULT(0x8041010e, errno 14). The shared socket-option copy helper applies the same guards to kernel callers and returns errno 14 on rejection. The existing kernel null-value length reset is guarded too.Rebased onto
4b1a9a3b2f51efe6fcde289ba0788f3cfffe2f32, the actual merge of #9525, preserving upstreamSO_TYPE/SO_ACCEPTCONN,SO_PROTOCOL, keepalive and nodelay behavior and their complete tests.Use exported
extern "C"GuestSocketSetIpv6LevelOption_nid_no_patchandGuestSocketGetIpv6LevelOption_nid_no_patchbridges for the Net-to-kernel boundary, addressing the patched-module review. The bridges delegate to the existing option backend and preserve its input, error and output-guard behavior. Their declarations have one canonical header reachable throughlibkernel.hpp.#9525 merged as
4b1a9a3b2f51at 2026-10-26 11:01:28 UTC, with author headea7109554ca5c49458c7250bedf486720079b21c. This rebase fulfills the agreed #9525-first order. ItsGuestNetSocketState.cppand completeguest_net_socket_stateregistration are retained byte-for-byte; the full upstream Net CMake remains intact with both IPv6 test blocks added. The IPv6 implementation, guest-output guards, exported C bridges and real patched-module test remain intact too. The checklist retains #9525 to record the fulfilled dependency.Tested
Maintainer CI update for unchanged head
ada64cab1e4b:40390920026/a1 completed SUCCESS (six jobs succeeded, two skipped). Base
b9c30ee5054d; ordered inputs #10949ada64cab1e4b, #1102565172ff41479, #10907476b63dd4581, #10988a9051f9aacb2, #10991882a3e39b67d. Linux: 2,311 passed, 93 validated expected skips, zero failed / 2,404. Windows: 1,694 passed, 816 validated expected skips, zero failed / 2,510. All 65 header cases passed on each platform.40392894595/a1 completed FAILURE (eleven jobs succeeded, Windows failed). Base
43c084150717; ordered inputs #9867b70c7ceb63ca, #10949ada64cab1e4b, #1102565172ff41479, #10925f4296894ac39, #10988a9051f9aacb2. Linux: 2,312 passed, 93 validated expected skips, zero failed / 2,405, including all 65 header cases. Windows: 1,630 passed, 816 observed skips, one timeout and 64 Not Run / 2,511.public_headerstimed out at 30.01 seconds, preventing its 64 dependent compilation cases from running; the skip validator did not execute. No compiler/declaration diagnostic established the timeout's cause or attribution to Net.All nine selected network/option/module cases passed on both platforms in both batches, including ordinary/patched IPv6 checks and
patched_libraries. Raw source guards and five successful merges bind each job to its listed inputs. The second batch remains failed despite its Linux success.Source and the #9525 dependency are unchanged; these results cover only the stated composites, and all earlier evidence and failure history below retain their original scopes.
Current preserving-rebase head:
ada64cab1e4b7b29594b7f273adb5f0527adca43, based on actual merged main4b1a9a3b2f51efe6fcde289ba0788f3cfffe2f32. Linux x86-64, GCC 16.2.1, Release: 51/51 selected CTests passed, without skips, with explicit/dev/nullstdin. These are all current Net and NetCtl CTests plus the kernel socket regressions,guest_recvmsg_memoryand the actual patched-library loader. The complete new socket-state fixture, protocol/nodelay/keepalive tests, both IPv6 fixtures, mapped-output guards and callback/network regressions all execute.Freshly built libc, libkernel, libkernel_sys, libSceLibcInternal, Net, NetCtl, PosixForWebKit and SpSysCallWrapper from this exact source. Current upstream PosixForWebKit requires libkernel_sys, so the actual bounded closure is eight patched PRXs, all loaded successfully. The ignored component driver uses the normal module CMake bodies, exact normal helper functions and real source-built NID patcher with production copy/patch and libc-export exclusion rules. Its local
libstarget covers those eight modules; the checked-in fixture still depends on the repository's fulllibstarget. This is not a full 368-library product run. The fresh build compiled 217 objects; all 340 actual project inputs and 47 produced module/patcher/fixture artifacts are bound to this head. Existing source-built ZArchive/zstd archives were reused after rechecking 78 source/header inputs and both archive hashes. No core PRX was imported.The initial broad run retained 50 passes and one
guest_sce_netfailure with inherited regular-file stdin. That unchanged fixture assumes stdin is not read-ready at its standard-descriptorselectassertion. A separate fresh exact-parent build and the rebased build both fail with regular heredoc stdin and both pass with/dev/nullcharacter stdin; actual child descriptor types/paths were captured. A private diagnostic-only copy observesselectreturning 3/read-mask 1/write-mask 6 for regular stdin and 2/read-mask 0/write-mask 6 for/dev/null. No production behavior or assertion was changed. The final unchanged 51-case suite uses the explicitly recorded/dev/nullcontext and passes completely; the initial failure and all four original-fixture parent/branch controls remain preserved. These controls cover that one parent fixture, not a full 51-case parent baseline.The full public-header audit passed (368 umbrellas / 12,228 guest exports), as did eight standalone repeated-inclusion units and one combined typed composition unit. Normal registration auditing found 312 generated executable targets and no unregistered target; only 30 selected fixture targets were built and 51 cases executed. Conventions and whitespace checks pass. Source and loader evidence retains both C bridges and binds the new fixture to the newly built patched providers. The source-preserving rebase has independent peer review; author-run Windows/macOS, full-product and physical PS5 execution are not claimed. Please rerun maintainer full Linux/Windows CI on this head and re-review before merging.
An independent Windows report by ycbuzi covers exact
ada64cab1emerged onto main2cce8bc51d: Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release.patched_libraries,net_ipv6onlyandnet_ipv6only_patchedeach passed 2/2 withctest --repeat until-fail:2; Net and its importers loaded successfully. Keeping the PR tests while substituting main's five production files made both IPv6 fixtures fail. oneandonlydean acknowledged that this covers the Windows error-127 load failure, while rebase review and full Linux/Windows CI remain pending. This is attributed native Windows component evidence, separate from author-run Linux checks and hosted full-product CI.Historical pre-parent validation follows; it does not qualify the new rebase:
Historical pre-parent bridge-fix head:
4bc97938d2edbfbc0b3a860ec55fc1a5ae4eef64, a child ofe8a1b7642cf4a4c36704064224f1abe17dab31d5. The branch ancestor remains4017310678562c63594d99b8f45db2d68b9aaa6c; this revision has not been rebased onto the later static-check base below. Linux x86-64, GCC 16.2.1, Release: 7/7 selected CTests passed, with no skips.Freshly built the actual libc, libkernel, libSceLibcInternal, Net, NetCtl, PosixForWebKit and SpSysCallWrapper library CMake bodies and the source-built NID patcher. The private component driver stages these seven real patched PRXs with the production copy/patch commands and actual libc export exclusions. It defines its local
libstarget over this bounded closure; the checked-in test depends on the repository's ordinary fulllibstarget. This local run is not the full 368-library product build. Normal CTest registration auditing found 304 generated executable targets and no unregistered target; it does not mean all 304 were built or executed.The seven executed cases were
patched_libraries,net_ipv6only_patched,net_ipv6only,guest_net_protocol,guest_net_buffer_validation,guest_socket_optionsandguest_socket_options_multicast. The unchanged loader test reported seven patched libraries loaded and zero failures. The new standalone fixture links no guest PRX, resolves guest functions by their production NIDs, and exercises TCP/UDP V6ONLY setters/getters, Boolean normalization, capacities 0–8, canaries, invalid lengths and unchanged option state. Actual loader traces bind its Net, kernel and libc to the staged patched directory. Both raw C bridge exports/imports remain intact after patching. A controlled substitution of the previously qualified E8 patched Net into the same new dependency closure makes this fixture fail on the unresolved C++ getter; this is an old-consumer control, not a complete parent-tree baseline.The fresh build took 209 steps and compiled 187 objects; all 307 actual project source/header inputs match this committed head. Existing source-built ZArchive/zstd archives were reused after rechecking their 78 source/header inputs and archive hashes; no core PRX was imported. The full public-header audit passed (368 umbrellas / 12,192 guest exports), as did three standalone repeated-inclusion/type composition units, registration, conventions and whitespace checks. Socket tests required execution outside the local network-restricted sandbox after ordinary host IPv4/IPv6 sockets also returned
EPERM; that restricted attempt is retained separately from the successful run.A static merge with main
5b5d24cb223ede690fe5eab1fe2f7a1736b801a5is clean. That is not a runtime test of the merge. There is no new Windows, full-product or console execution claim for this bridge revision; maintainer full Linux/Windows CI should be rerun on the new head. At that earlier point #9525 was still pending; its later merge and the preserving rebase validated above fulfill that landing order.Historical pre-bridge evidence follows; those earlier direct-link tests did not validate loaded patched Net imports:
Historical tested head:
e8a1b7642cf4a4c36704064224f1abe17dab31d5. Linux x86-64, GCC 16.2.1, Release: 32/32 focused runtime tests pass, without skips. Built the complete modifiedlibkernelandlibSceNetPRXs pluslibSceNetCtlthrough their runtime CMake, and produced patched PRX artifacts. libc/libSceLibcInternal dependencies were freshly rebuilt at the exact base; the modified helper was compiled into this branch's own kernel binary.The IPv6 suite covers existing mapped TCP/UDP traffic and option validation, plus both Net and kernel getters into real shared direct-memory mappings. Mapped capacities 0,1,2,3,4,5,8 and
UINT32_MAX, alias readback, canaries and read-only pages immediately beyond the exact output ranges check bounded writes and zero-capacity behavior. Existing kernel socket-option and multicast regressions pass.Windows-only regression code uses tracked direct mappings to verify failed
HostWrite::Open()for read-only value/length outputs, guestEFAULT, unchanged outputs on rejection, null kernel output handling and write-watch reporting. These Windows checks were not run by the author on this Linux host; the independent native Windows results are linked below; non-WindowsOpen()always succeeds, so Linux execution does not establish that rejection path. Author-run Windows/macOS/PS5 execution and a monolithic repository build were not performed; the separate Windows report is attributed below.Both canonical umbrella headers compile standalone with repeated inclusion; the full public-header audit passes (368 libraries / 12,192 exports). Conventions and whitespace checks pass.
An independent exact-head Windows report covers
e8a1b7642cmerged onto maind2b3ee3bcc, Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7, Release. All 18 targeted Net/socket tests passed both repeated runs, including real IPv6 and the Windows-only read-only value/length rejection and write-watch cases. Its reverted-source control failed the IPv6 feature test. This is reviewer-reported native Windows evidence, separate from the author-run Linux suite and from hosted product CI.Historical private integration with #9525
ea7109554cand this heade8a1b7642cpassed 35/35 focused Linux tests without skips, including guest_net_socket_state and net_ipv6only. The exact union isc885fed64f5b84709a416c7b3323ff5d4173ce4f, based on its actual upstream ancestorb4d8e8bb3b. Its libc, libkernel, libSceLibcInternal, Net and NetCtl modules were built from that union, including the modified kernel guards; runtime bindings and hashes were checked. Complete feature/test blocks, upstream protocol/nodelay behavior, canonical headers and debt are preserved. Header, conventions, whitespace and independent peer checks pass. This is a private Linux combination; the earlier Windows report remains scoped to e8a and its reported merge, and the new socket-state direct-output paths are not newly validated on Windows here.Historical private option-dispatch integration additionally passed 42/42 registered Linux tests, with independent source/runtime peer review, at composition
478e95a54c8c(tree0261c6ca38f5). It combines published Nete8a1b7642cf4, NetCtle6ac99c16325, #9525ea7109554ca5, #951500924d8f9f8aand #957889da0c7455d4, starting from main1997e647f93cand preserving #9578's inherited main2b5225605bd5. All five runtime PRXs and the patcher were freshly built from that view. Four private routing cases cover direct Net, Ex-to-Net, kernel forwarding of Net-owned descriptors, and kernel-owned descriptors, including error conversion, bounded/aliased IPv6 outputs, null/capacity rules and preserved V6 callbacks. Header/conventions checks pass. Tests execute ordinary canonical API calls on the actual unpatched libraries; patched artifacts were separately generated. Windows rejected-write subcases were unavailable on Linux, and this is not a full-product, patched-title or console result. The earlier Windows report still covers its exact published E8 source only. This composition does not add dependencies, change the agreed #9525-before-#10949 order, or waive other input authors' prerequisites; that historical composition left the published E8 source unchanged and did not include this bridge revision.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T11:36:36Z.
Review: CHANGES_REQUESTED
The new
sceNetGetsockoptIPv6 path callsGuestSockets::GetIpv6LevelOption, whoseCopy()helper writes bothoptvaland*optlendirectly. Neither write is covered byGuestArena::HostWrite. The repository's memory-write convention requires a guard over host writes into guest memory; without it, write-watch/shared-backing state is missed and protected guest pages can reject the write. The new test passes ordinary stack buffers, so it does not exercise that contract. Please ensure this entry point (and the shared option helper it invokes) guards the bounded output range and length pointer, returning the expected guest error if a guard cannot be opened, then cover it with a guest-backed output test.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T13:28:08Z.
Review: APPROVED
Reviewed exact updated head
e8a1b7642cf4a4c36704064224f1abe17dab31d5. The Net IPv6 path stages the value and returned length locally, opens both bounded output scopes before either guest store, and maps failed opens to guestEFAULT. The kernelCopyhelper now applies the same ordering, and the null-value length reset is guarded. Guest-mapped tests cover aliases, truncation/zero capacity, canaries, read-only adjacent ranges, unchanged outputs on rejection, and Windows write-watch collection.I ran
python3 tools/check_conventions.py --base upstream/main --head HEADandgit diff --check upstream/main...HEAD; both pass. The author reports 32/32 focused Linux tests across the modified Net/kernel runtime builds. Windows-specific rejection/write-watch tests are present but unrun; hosted product jobs are skipped. The requested output-guard gap is fixed, with no remaining blocker found in this scoped change.