From: Paul Floyd Date: Sun, 14 Dec 2025 12:31:18 +0000 (+0100) Subject: Darwin fdleaks: fix handling of recvmsg cmsg X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6878e3f78fe16aa0e758a5eb4483a9c4834e7cb3;p=thirdparty%2Fvalgrind.git Darwin fdleaks: fix handling of recvmsg cmsg In the Darwin headers the macro __DARWIN_ALIGN32 is used for the CMSG macros. We were using just ALIGN which looks like it uses __DARWIN_ALIGN for 8 byte alignment. Using the wrong alignment gate a wrong count of fds and check_cmsg_for_fds was only calling ML_(record_fd_open_named) for one fd. The result was fd errors when writing to a second fd that should have been recorded. --- diff --git a/include/vki/vki-darwin.h b/include/vki/vki-darwin.h index 056bd9e89..5e381ab4c 100644 --- a/include/vki/vki-darwin.h +++ b/include/vki/vki-darwin.h @@ -296,7 +296,7 @@ typedef uint32_t vki_u32; #define vki_cmsghdr cmsghdr -#define VKI_CMSG_ALIGN(a) ALIGN(a) +#define VKI_CMSG_ALIGN(a) __DARWIN_ALIGN32(a) #define VKI_CMSG_DATA(cmsg) CMSG_DATA(cmsg) #define VKI_CMSG_FIRSTHDR(mhdr) CMSG_FIRSTHDR(mhdr) #define VKI_CMSG_NXTHDR(mhdr, cmsg) CMSG_NXTHDR(mhdr, cmsg)