Skip to content

Commit 504ee9f

Browse files
committed
[Sanitizers] Guard FP_XSTATE_MAGIC1 usage by GLIBC version
Follow-up on https://reviews.llvm.org/D118970 FP_XSTATE_MAGIC1 is only available on glibc 2.27 and upwards Differential Revision: https://reviews.llvm.org/D124770
1 parent aeab7ea commit 504ee9f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ namespace __sanitizer {
223223
unsigned struct_sockaddr_sz = sizeof(struct sockaddr);
224224

225225
unsigned ucontext_t_sz(void *ctx) {
226-
# if SANITIZER_GLIBC && SANITIZER_X64
226+
# if SANITIZER_GLIBC && SANITIZER_X64 && __GLIBC_PREREQ (2, 27)
227227
// Added in Linux kernel 3.4.0, merged to glibc in 2.16
228228
# ifndef FP_XSTATE_MAGIC1
229229
# define FP_XSTATE_MAGIC1 0x46505853U

compiler-rt/test/msan/Linux/signal_mcontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
void handler(int sig, siginfo_t *info, void *uctx) {
1212
__msan_check_mem_is_initialized(uctx, sizeof(ucontext_t));
13-
#if defined(__GLIBC__) && defined(__x86_64__)
13+
#if defined(__GLIBC__) && defined(__x86_64__) && __GLIBC_PREREQ(2, 27)
1414
auto *mctx = &static_cast<ucontext_t *>(uctx)->uc_mcontext;
1515
if (auto *fpregs = mctx->fpregs) {
1616
// The member names differ across header versions, but the actual layout

0 commit comments

Comments
 (0)