[sanitizer] Correct alignment of x32 __sanitizer_siginfo
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 26 Apr 2023 23:34:08 +0000 (16:34 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 27 Apr 2023 01:27:38 +0000 (18:27 -0700)
Since alignment of x32 siginfo_t is 8 bytes, not 4 bytes, use u64 in
__sanitizer_siginfo_pad to align x32 __sanitizer_siginfo to 8 bytes.

Fixes https://github.com/llvm/llvm-project/issues/62394

Differential Revision: https://reviews.llvm.org/D149309

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h

index cfca7bd..e6f298c 100644 (file)
@@ -578,8 +578,13 @@ struct __sanitizer_sigset_t {
 #endif
 
 struct __sanitizer_siginfo_pad {
+#if SANITIZER_X32
+  // x32 siginfo_t is aligned to 8 bytes.
+  u64 pad[128 / sizeof(u64)];
+#else
   // Require uptr, because siginfo_t is always pointer-size aligned on Linux.
   uptr pad[128 / sizeof(uptr)];
+#endif
 };
 
 #if SANITIZER_LINUX