I have seen two examples of programs that use SCM_TIMESTAMP and/or SCM_BINTIME that work correctly on amd64 or i386, but fail when the i386 binaries are executed on an amd64 kernel. The easiest way to reproduce this problem is: i386_host $ cd /usr/src/tools/regression/sockets/unix_cmsg i386_host $ make i386_host $ ./unix_cmsg i386_host $ # Observe that everything passes i386_host $ # somehow transfer the unix_cmsg binary to an amd64 system amd64_host $ ./unix_cmsg Running tests for SOCK_STREAM sockets: 1: Sending, receiving cmsgcred 2: Receiving sockcred (listening socket) 3: Receiving sockcred (accepted socket) 4: Sending cmsgcred, receiving sockcred 5: Sending, receiving timeval SERVER: msghdr.msg_flags has MSG_CTRUNC 6: Sending, receiving bintime SERVER: msghdr.msg_flags has MSG_CTRUNC 7: Check cmsghdr.cmsg_len 8: Check LOCAL_PEERCRED socket option -- 2 tests failed! Running tests for SOCK_DGRAM sockets: 1: Sending, receiving cmsgcred 2: Receiving sockcred 3: Sending cmsgcred, receiving sockcred 4: Sending, receiving timeval SERVER: msghdr.msg_flags has MSG_CTRUNC 5: Sending, receiving bintime SERVER: msghdr.msg_flags has MSG_CTRUNC 6: Check cmsghdr.cmsg_len -- 2 tests failed!
A commit references this bug: Author: sobomax Date: Thu Sep 7 04:29:57 UTC 2017 New revision: 323254 URL: https://svnweb.freebsd.org/changeset/base/323254 Log: In the recvmsg32() system call iterate over returned structure(s) and convert any messages of types SCM_BINTIME, SCM_TIMESTAMP, SCM_REALTIME and SCM_MONOTONIC from 64-bit to its 32-bit representation. Otherwise we either run out of user-supplied buffer to copy those out resulting in the MSG_CTRUNC or simply return values that the userland 32-bit code is not going to parse correctly. This fixes at least two regression tests failing to function properly in 32-bit compat mode: tools/regression/sockets/udp_pingpong tools/regression/sockets/unix_cmsg PR: kern/222039 MFC after: 30 days Changes: head/sys/compat/freebsd32/freebsd32.h head/sys/compat/freebsd32/freebsd32_misc.c
Hooray! Thanks Sobomax.
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Resetting the MFC flag, because this never got MFCed.
Any plans to MFC this?
MFC is done.
For the record, the MFC commit was r338617.