libSceNet: sceNetSendmsg crashes the host on unreadable guest payload instead of returning EFAULT #11467
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 lgqdaxia on 2026-10-26T15:13:27Z.
What happens
In a source-linked Windows test, calling
libSceNet'ssceNetSendmsgwith an iovec payload that crosses from a readable guest page into an unreadable guest page terminates the host test process with access violation0xC0000005, instead of returning SCE NetEFAULT.Title, test or build step
Local source-based test fixture
guest_net_sendmsg_boundary_tests(the relevant call sequence is included below). No retail title or console module was used.AnyPS5 commit
Built and tested at
263fbcd2d3ab888292062a5dbd441387309b66e0, with no production-source changes.I also checked current
mainat7903201bb426f7f1e8565e98cc3df299d849edc7.core/libs/prx/libSceNet/Export.cppis identical between those commits, including the affected path. I did not rerun the executable against the newer commit.System
Windows 11 x64
10.0.26200.9711, Intel Core i7-12700H, CMake Release, Ninja, MinGW-w64 GCC 15.2.0 r7,BUILD_TESTING=ON. GPU/driver: not involved in this CPU/network test.Steps to reproduce
libSceNet, create valid sender and receiver UDP sockets, bind the receiver to loopback, and use its address as the destination.NetMsghdrand one-entryNetIovecin readable guest memory.sceKernelMprotect(page3, 0x4000, 0).sceNetSendmsg(sender, message, 0).This is a local fixture; the target below is not present in upstream
main. Save the complete source below ascore/libs/tests/GuestNetSendmsgBoundary.cpp, then add the following lines inside the existing Windows test block incore/libs/prx/libSceNet/CMakeLists.txt:Complete GuestNetSendmsgBoundary.cpp
I configured, built, and ran it with the following PowerShell commands.
X:was a local drive mapping for the AnyPS5 workspace:accessibleuses the same setup with an 8-byte iovec that stays within the readable page.sendto-controlpasses the same unreadable 16-byte range tosceNetSendtoand checks for0x8041010e/ errno 14 (EFAULT).Log
Ten fresh runs of each mode produced:
What was checked
sceNetSendmsgsucceeds when the whole payload is readable.sceNetSendtocontrol confirms that the same unreadable range can be translated to guestEFAULTwithout terminating the process.The direct cause is the unchecked host
std::memcpyinsceNetSendmsg. The precedingmessage_lengthwalk also directly dereferences guest-owned header and iovec memory.Related work: #8462 / #8463 cover the analogous
libkernelsendmsg_nid_postfiximplementation, not this separatelibSceNetpath; #8463 does not changecore/libs/prx/libSceNet/Export.cpp. PR #5930 added protected guest writes forsceNetRecvmsg, but does not validatesceNetSendmsginputs.AI-assisted: Codex