[PATCH] D46638: [sanitizer] Fix runtime crash on 32-bit Linux with glibc 2.27

Peter Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 9 07:50:43 PDT 2018


Lekensteyn created this revision.
Lekensteyn added reviewers: kcc, dvyukov, vitalybuka, jakubjelinek.
Lekensteyn added a project: Sanitizers.
Herald added subscribers: Sanitizers, llvm-commits, kubamracek, srhines.

The calling convention for _dl_get_tls_static_info symbol has changed on
32-bit systems since glibc 2.27. Make sure to support older and newer
32-bit glibc versions with the same runtime library.

Reuse the version check from InitTlsSize. Use gnu_get_libc_version
rather than confstr(_CS_GNU_LIBC_VERSION) because the latter is
intercepted by msan. This symbol existed since February 1998.

This patch does not try to address other issues with glibc 2.25.
Tested with 32/64-bit glibc 2.26/2.27 on Arch Linux.

Fixes https://github.com/google/sanitizers/issues/954

___

This is an alternative patch to https://reviews.llvm.org/D44623 by Jakub, addressing some review comments from there (reduce ifdef magic, coding style) and using a different approach for version detection. If desired, GetGlibVersion runtime could be guarded under a `__GLIBC_PREREQ` check, but there is potentially much more code that could be hidden that way so I did not do this.

Test: all check-sanitizers tests pass on Linux with glibc 2.27 except SanitizerCommon-asan-i386-Linux (unrelated) and SanitizerCommon-lsan-x86_64-Linux (not sure, probably also unrelated).


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D46638

Files:
  lib/sanitizer_common/sanitizer_linux_libcdep.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46638.145915.patch
Type: text/x-patch
Size: 4253 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180509/cf6df822/attachment.bin>


More information about the llvm-commits mailing list