This is an archive of the discontinued LLVM Phabricator instance.

[sanitizers] Update sanitizers test to better match glibc internals
ClosedPublic

Authored by rovka on Sep 20 2016, 7:47 AM.

Details

Summary

One of the tests relying on sem_t's layout gets the wrong value for versions of
glibc newer than 2.21 on platforms that don't have 64-bit atomics (e.g. ARM).

This commit fixes the test to work with:

  • versions of glibc >= 2.21 on platforms with 64-bit atomics: unchanged
  • versions of glibc >= 2.21 on platforms without 64-bit atomics: the semaphore

value is shifted by SEM_VALUE_SHIFT (which is set to 1 in glibc's internal
headers)

  • versions of glibc < 2.21: unchanged

See the glibc 2.23 sources:

  • sysdeps/nptl/internaltypes.h (struct new_sem for glibc >= 2.21 and struct old_sem for glibc < 2.21)
  • nptl/sem_getvalue.c

This was uncovered on one of the new buildbots that we are trying to move to
production (ARM with glibc 2.23). I have tested on x86_64 with glibc 2.21 and
2.17, AArch64 with glibc 2.21 and ARM with glibc 2.19 and 2.23.

Diff Detail

Event Timeline

rovka updated this revision to Diff 71932.Sep 20 2016, 7:47 AM
rovka retitled this revision from to [sanitizers] Update sanitizers test to better match glibc internals.
rovka updated this object.
rovka added reviewers: zatrazz, eugenis.
rovka added subscribers: rengolin, llvm-commits.

This patch fixes our new Xenial buildbot[1], just waiting for that to go live.

cheers,
--renato

[1] http://buildmaster.tcwglab.linaro.org/builders/clang-cmake-thumbv7-a15-full-sh

eugenis accepted this revision.Sep 20 2016, 2:45 PM
eugenis edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 20 2016, 2:45 PM
This revision was automatically updated to reflect the committed changes.