https://sourceware.org/cgit/valgrind/commit/?id=6878e3f78fe16aa0e758a5eb4483a9c4834e7cb3
commit 6878e3f78fe16aa0e758a5eb4483a9c4834e7cb3
Author: Paul Floyd <pj...@wa...>
Date: Sun Dec 14 13:31:18 2025 +0100
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:
---
include/vki/vki-darwin.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/vki/vki-darwin.h b/include/vki/vki-darwin.h
index 056bd9e890..5e381ab4c6 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)
|