mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 04:29:42 +00:00
[msan] Guard FP_XSTATE_MAGIC1 usage with SANITIZER_GLIBC
Fix build for Linux musl. Reviewed By: #sanitizers, dvyukov Differential Revision: https://reviews.llvm.org/D118970
This commit is contained in:
parent
f3f8e3da9f
commit
9d1857f69f
@ -217,7 +217,7 @@ namespace __sanitizer {
|
||||
unsigned struct_sockaddr_sz = sizeof(struct sockaddr);
|
||||
|
||||
unsigned ucontext_t_sz(void *ctx) {
|
||||
# if SANITIZER_LINUX && SANITIZER_X64
|
||||
# if SANITIZER_GLIBC && SANITIZER_X64
|
||||
// See kernel arch/x86/kernel/fpu/signal.c for details.
|
||||
const auto *fpregs = static_cast<ucontext_t *>(ctx)->uc_mcontext.fpregs;
|
||||
// The member names differ across header versions, but the actual layout
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
void handler(int sig, siginfo_t *info, void *uctx) {
|
||||
__msan_check_mem_is_initialized(uctx, sizeof(ucontext_t));
|
||||
#if defined(__x86_64__)
|
||||
#if defined(__GLIBC__) && defined(__x86_64__)
|
||||
auto *mctx = &static_cast<ucontext_t *>(uctx)->uc_mcontext;
|
||||
if (auto *fpregs = mctx->fpregs) {
|
||||
// The member names differ across header versions, but the actual layout
|
||||
|
@ -1,6 +1,7 @@
|
||||
// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
|
||||
|
||||
// REQUIRES: x86_64-target-arch
|
||||
// musl does not define FP_XSTATE_MAGIC1.
|
||||
// REQUIRES: x86_64-target-arch && glibc-2.27
|
||||
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user