From 70986ea3d6aeacb5d10bfe3b75757611d4e7a379 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 6 Nov 2021 22:26:05 -0800 Subject: [PATCH] [sanitizer][aarch64] Add cast to drop reliance on the type of uc_mcontext.__reserved https://sourceware.org/bugzilla/show_bug.cgi?id=22742 uc_mcontext.__reserved probably should not be considered user visible API but unfortunate it is: it is the only way to access cpu states of some Linux asm/sigcontext.h extensions. That said, the declaration may be long double __reserved[256]; (used by musl) instead of unsigned char __reserved[4096] __attribute__((__aligned__(16))); (glibc) to avoid dependency on a GNU variable attribute. --- compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp index 826c6d3..d171e91 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp @@ -1773,7 +1773,7 @@ struct __sanitizer_esr_context { static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) { static const u32 kEsrMagic = 0x45535201; - u8 *aux = ucontext->uc_mcontext.__reserved; + u8 *aux = reinterpret_cast(ucontext->uc_mcontext.__reserved); while (true) { _aarch64_ctx *ctx = (_aarch64_ctx *)aux; if (ctx->size == 0) break; -- 2.7.4