Hi! On Tue, Nov 12, 2019 at 12:27:26PM +0100, Jakub Jelinek wrote: > But I'm afraid I don't really have the cycles to test this on all targets, > nor does it fix the arm be or s390 31-bit problem with shmctl.
I have committed the following change cherry-picked from upstream, before submitting there tested on {x86_64,i686,ppc64le,s390x,armv7hl,aarch64}-linux with both older glibc and with master glibc (in that case the patch tweaked to have __GLIBC_PREREQ (2, 30) instead of 2, 31, so that even before the 2.31 release on a glibc known to have the new layout it would verify what will be verified in glibc 2.31. arm big endian and s390 31-bit is still broken for shmctl and I'm afraid fixing that is going to be extremely hard. 2019-11-26 Jakub Jelinek <ja...@redhat.com> PR sanitizer/92154 * sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce. * sanitizer_common/sanitizer_platform_limits_posix.cpp: Likewise. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp (revision 278721) +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp (working copy) @@ -1128,11 +1128,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); CHECK_SIZE_AND_OFFSET(ipc_perm, gid); CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); -#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \ - !defined(__arm__) -/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ -/* On Arm newer glibc provide a different mode field, it's hard to detect - so just disable the check. */ +#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) +/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit + on many architectures. */ CHECK_SIZE_AND_OFFSET(ipc_perm, mode); #endif --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h (revision 278721) +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h (working copy) @@ -207,26 +207,13 @@ struct __sanitizer_ipc_perm { u64 __unused1; u64 __unused2; #elif defined(__sparc__) -#if defined(__arch64__) unsigned mode; - unsigned short __pad1; -#else - unsigned short __pad1; - unsigned short mode; unsigned short __pad2; -#endif unsigned short __seq; unsigned long long __unused1; unsigned long long __unused2; -#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) - unsigned int mode; - unsigned short __seq; - unsigned short __pad1; - unsigned long __unused1; - unsigned long __unused2; #else - unsigned short mode; - unsigned short __pad1; + unsigned int mode; unsigned short __seq; unsigned short __pad2; #if defined(__x86_64__) && !defined(_LP64) Jakub