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 97eae3fc7bc..4089d4695e2 100644 | |
13 | --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | |
14 | +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | |
15 | @@ -1145,8 +1145,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); | |
16 | CHECK_SIZE_AND_OFFSET(ipc_perm, gid); | |
17 | CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); | |
18 | CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); | |
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 c139322839a..7c3c2d866e5 100644 | |
29 | --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | |
30 | +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h | |
31 | @@ -211,20 +211,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 |