Commit | Line | Data |
---|---|---|
a33eac03 MB |
1 | Fix assertion failure in libsanitizer when using glibc 2.31 and later. |
2 | ||
3 | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154 | |
4 | https://reviews.llvm.org/D69104 | |
5 | ||
6 | Adapted from these upstream revision: | |
7 | ||
8 | https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981 | |
9 | https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653 | |
10 | ||
11 | diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | |
12 | index 069d8d557de..c49c28c6e07 100644 | |
13 | --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | |
14 | +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | |
15 | @@ -1130,8 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); | |
16 | #ifndef __GLIBC_PREREQ | |
17 | #define __GLIBC_PREREQ(x, y) 0 | |
18 | #endif | |
19 | -#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) | |
20 | -/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ | |
21 | +#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) | |
22 | +/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit | |
23 | + on many architectures. */ | |
24 | CHECK_SIZE_AND_OFFSET(ipc_perm, mode); | |
25 | #endif | |
26 | ||
27 | diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | |
28 | index 304d04e3935..6dee89c97e1 100644 | |
29 | --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | |
30 | +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | |
31 | @@ -207,20 +207,13 @@ namespace __sanitizer { | |
32 | unsigned long __unused1; | |
33 | unsigned long __unused2; | |
34 | #elif defined(__sparc__) | |
35 | -# if defined(__arch64__) | |
36 | unsigned mode; | |
37 | - unsigned short __pad1; | |
38 | -# else | |
39 | - unsigned short __pad1; | |
40 | - unsigned short mode; | |
41 | unsigned short __pad2; | |
42 | -# endif | |
43 | unsigned short __seq; | |
44 | unsigned long long __unused1; | |
45 | unsigned long long __unused2; | |
46 | #else | |
47 | - unsigned short mode; | |
48 | - unsigned short __pad1; | |
49 | + unsigned int mode; | |
50 | unsigned short __seq; | |
51 | unsigned short __pad2; | |
52 | #if defined(__x86_64__) && !defined(_LP64) | |
53 |