On Tue, Oct 22, 2019 at 10:00:39AM +0000, Tamar Christina wrote:
> Glibc has recently introduced changed to the mode field in ipc_perm
> in commit 2f959dfe849e0646e27403f2e4091536496ac0f0. For Arm this
> means that the mode field no longer has the same size.
>
> This causes an assert failure against libsanitizer's internal copy
> of ipc_perm. Since this change can't be easily detected I am adding
> arm to the list of targets that are excluded from this check. libsanitizer
> doesn't use this field (and others, it in fact uses only 1 field) so this
> check
> can be ignored.
>
> Padding bits were used by glibc when the field was changed so sizeof and
> offsets
> of the remaining fields should be the same.
>
> Bootstrapped arm-none-linux-gnueabihf and no issues.
>
> Ok for trunk?
>
> Thanks,
> Tamar
>
> libsanitizer/ChangeLog:
>
> 2019-10-22 Tamar Christina <[email protected]>
>
> PR sanitizer/92154
> * sanitizer_common/sanitizer_platform_limits_posix.cpp (defined):
> Exclude arm.
defined is not an entity you are changing, plus for cherry-picks from
upstream we usually just write:
* sanitizer_common/sanitizer_platform_limits_posix.cpp: Cherry-pick
compiler-rt revision 123456.
where 123456 is the svn revision from compiler-rt.
> --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
> +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
> @@ -1126,8 +1126,12 @@ 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)
> +#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) &&
> \
> + !defined(__arm__)
> /* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
> +/* On Arm glibc 2.31 and later provide a different mode field, this field is
> + never used by libsanitizer so we can simply ignore this assert for all
> glibc
> + versions. */
> CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
> #endif
>
>
This is ok because it is merged from upstream with the above ChangeLog
change, but the #if doesn't do what the comment says, I would have expected
at least
+ (!defined(__arm__) || !SANITIZER_LINUX)
or even better
+ (!SANITIZER_ARM || !SANITIZER_LINUX)
which would be closer to the compiler-rt style. Also wonder why there is no
SANITIZER_AARCH64 macro. But that is all upstream should care about.
Jakub