[Bug 236737] recvmsg() under COMPAT_FREEBSD32 returns the wrong msg_controllen value
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Mar 23 17:14:20 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236737
Bug ID: 236737
Summary: recvmsg() under COMPAT_FREEBSD32 returns the wrong
msg_controllen value
Product: Base System
Version: 12.0-RELEASE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: kern
Assignee: bugs at FreeBSD.org
Reporter: paulzhol at gmail.com
Created attachment 203071
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=203071&action=edit
udp recvmsg with IP_RECVDSTADDR, IP_RECVTTL and IP_RECVIF setsockopts enabled
The returned msg_controllen is shorter under FreeBSD AMD64 12.0-RELEASE with
COMPAT_FREEBSD32 mode compared to the same value on an actual i386 system.
While the returned msg_controllen is shorter, the corresponding cmsg_len values
remain the same.
This causes the last cmsg to exceed the msg_control[0:msg_controllen] buffer.
This does not seem to be detected using the CMSG_NXTHDR/CMSG_DATA macros.
This behavior triggers unit test failures in the Go golang.org/x/net package.
A workaround has been applied in
https://go-review.googlesource.com/c/net/+/168297 where the kernel returned
msg_controllen is effectively extended to size passed by the caller.
Attached is a C demonstrator based on one of the unit tests.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list