From 0ba85ab4cc1882d42c27961997e8f6424e0a0f56 Mon Sep 17 00:00:00 2001 From: guzhihao4 Date: Mon, 7 Oct 2024 19:01:21 +0800 Subject: [PATCH] [Sanitizer]Fix sanitizer msghdr Sanitizer defines msghdr different from ohos libc. Modify it to keep the same as sanitizer. Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/IAV6I8 Signed-off-by: guzhihao4 Change-Id: I0f7efc8238ddd452525b3ac5c26ed65f96cccb83 --- .../sanitizer_platform_limits_posix.h | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h index ecd45138026c..733dde7f3d51 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -472,6 +472,41 @@ struct __sanitizer_cmsghdr { int cmsg_level; int cmsg_type; }; +// OHOS_LOCAL begin +#elif SANITIZER_OHOS +struct __sanitizer_msghdr { + void *msg_name; + unsigned msg_namelen; + struct __sanitizer_iovec *msg_iov; +#if LONG_MAX > 0x7fffffff && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + int __pad1; +#endif + unsigned msg_iovlen; +#if LONG_MAX > 0x7fffffff && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + int __pad1; +#endif + void *msg_control; +#if LONG_MAX > 0x7fffffff && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + int __pad2; +#endif + unsigned msg_controllen; +#if LONG_MAX > 0x7fffffff && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + int __pad2; +#endif + int msg_flags; +}; +struct __sanitizer_cmsghdr { +#if LONG_MAX > 0x7fffffff && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + int __pad1; +#endif + unsigned cmsg_len; +#if LONG_MAX > 0x7fffffff && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + int __pad1; +#endif + int cmsg_level; + int cmsg_type; +}; +// OHOS_LOCAL end #else // In POSIX, int msg_iovlen; socklen_t msg_controllen; socklen_t cmsg_len; but // many implementations don't conform to the standard. -- Gitee