libkernel: recvfrom on a TCP socket returns a fake 28-byte IPv6 sender address instead of length 0; fix branch ready #3942
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 husseinkad on 2026-10-11T19:27:37Z.
recvfromon a connected TCP socket with an address buffer reports an address length of 28 and fills in a made-up AF_INET6 address. FreeBSD 11.4kern_recvitreturns a sender address only for sockets that have one; a stream socket has none, so the length comes back 0 and the buffer is left alone. A guest that reads the length to decide whether a datagram sender is present is misled on TCP.Fix branch: https://github.com/husseinkad/AnyPS5/tree/fix/kernel-socket-recvfrom-stream-address (one commit on current main,
Socket/src/Udp.cppandtests/GuestTcp.cpp). When the host reports no AF_INET or AF_INET6 sender,recvfromnow reports length 0, which is whatrecvmsgalready does.Checks:
guest_tcpcase fails on main (assertion abort) and passes with the change;guest_(tcp|udp|poll|socket|dup)pass.MSG_PEEK, truncated and zero-length address buffers, zero-length data buffers and EOF on both ends. UDP IPv4 and IPv6 are byte-identical to main (sender address, family, port,sa_len, peek, truncated address buffer, zero-length datagram, connected socket). A nulladdrlenwith a non-null address still givesEFAULT; Unix socketpairs are unchanged.check_conventions.pyis clean andpr_overlap.pyfinds no overlap.Not covered: a truncated address buffer still returns the full length (16 or 28) where FreeBSD returns the smaller of the two; that comes from
GuestAddressand is the same on main, forrecvmsg,acceptandgetsocknametoo.recvfromon an unconnected TCP socket givesEINVALwhere FreeBSD givesENOTCONN, also unchanged. Only Windows was built and run.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T06:17:33Z.
Closing: fixed by #3957.
recvfromreports length 0 when the host returns no AF_INET or AF_INET6 sender (Socket/src/Udp.cpp). The truncated-length case you listed as not covered is in #4295.