cloudabi_sock_recv() and linux_recvmsg_common() use kern_recvit(), which may return control messages in addition to data. Suppose one uses sendmsg() to transmit multiple SCM_RIGHTS messages in a single call. When these messages are externalized, the unix socket code will place them in separate mbufs which get returned as a chain from kern_recvit(). From code inspection, some consumers only handle the first mbuf in the chain, so control messages will be dropped in some cases.
Hi, Is there somewhere an example of what needs to be done for a person without much knowledge about the network code, but interest to get one or both of the emulation areas fixed? Bye, Alexander.
(In reply to Alexander Leidinger from comment #1) You might compare handling of the "controlp == NULL" case in kern_recvit() with the handling of the "control != NULL" case in linux_recvmsg_common(). The former iterates over all mbufs in the chain, the latter does not.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3735f9cff1e8a7ce7079b957bc3b37f0f886caed commit 3735f9cff1e8a7ce7079b957bc3b37f0f886caed Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-05-28 20:48:45 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-05-28 20:48:45 +0000 linux(4): Handle multiple mbufs in a control message chain in recvmsg PR: 230274 MFC after: 2 weeks sys/compat/linux/linux_socket.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=82062a044383ecb402a1f003249359616a660390 commit 82062a044383ecb402a1f003249359616a660390 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-05-28 20:48:45 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:35:37 +0000 linux(4): Handle multiple mbufs in a control message chain in recvmsg PR: 230274 MFC after: 2 weeks (cherry picked from commit 3735f9cff1e8a7ce7079b957bc3b37f0f886caed) sys/compat/linux/linux_socket.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)