Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Mar 2019 17:14:17 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 236737] recvmsg() under COMPAT_FREEBSD32 returns the wrong msg_controllen value
Message-ID:  <bug-236737-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236737

            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@FreeBSD.org
          Reporter: paulzhol@gmail.com

Created attachment 203071
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D203071&action=
=3Dedit
udp recvmsg with IP_RECVDSTADDR, IP_RECVTTL and IP_RECVIF setsockopts enabl=
ed

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 va=
lues
remain the same.
This causes the last cmsg to exceed the msg_control[0:msg_controllen] buffe=
r.
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 packag=
e.
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.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236737-227>