]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Darwin fdleaks: fix handling of recvmsg cmsg
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 14 Dec 2025 12:31:18 +0000 (13:31 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 14 Dec 2025 12:31:18 +0000 (13:31 +0100)
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.

include/vki/vki-darwin.h

index 056bd9e8905621263d3babf8a6079299ff1441a1..5e381ab4c698316a52b61ede35d4fd98e20f9b44 100644 (file)
@@ -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)