summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl
diff options
context:
space:
mode:
authorMarcin Koscielnicki <koriakin@0x04.net>2016-04-14 12:56:24 +0000
committerMarcin Koscielnicki <koriakin@0x04.net>2016-04-14 12:56:24 +0000
commitc8dda336bbb7edd22df9dfd257d64b7e68514c1f (patch)
tree608a510219a33c4326cae4d36b23b65edf8cd95b /compiler-rt/lib/tsan/rtl
parent0ffa9eaa4a0f4ccbd30d30fed52ec15d8a0f70b8 (diff)
downloadbcm5719-llvm-c8dda336bbb7edd22df9dfd257d64b7e68514c1f.tar.gz
bcm5719-llvm-c8dda336bbb7edd22df9dfd257d64b7e68514c1f.zip
[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143.
In short, CVE-2016-2143 will crash the machine if a process uses both >4TB virtual addresses and fork(). ASan, TSan, and MSan will, by necessity, map a sizable chunk of virtual address space, which is much larger than 4TB. Even worse, sanitizers will always use fork() for llvm-symbolizer when a bug is detected. Disable all three by aborting on process initialization if the running kernel version is not known to contain a fix. Unfortunately, there's no reliable way to detect the fix without crashing the kernel. So, we rely on whitelisting - I've included a list of upstream kernel versions that will work. In case someone uses a distribution kernel or applied the fix themselves, an override switch is also included. Differential Revision: http://reviews.llvm.org/D18915 llvm-svn: 266297
Diffstat (limited to 'compiler-rt/lib/tsan/rtl')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
index c10fce5637e..e5c1ee04d07 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
@@ -247,6 +247,9 @@ static void InitDataSeg() {
#endif // #ifndef SANITIZER_GO
void InitializePlatformEarly() {
+#ifdef __s390x__
+ AvoidCVE_2016_2143();
+#endif
#ifdef TSAN_RUNTIME_VMA
vmaSize =
(MostSignificantSetBitIndex(GET_CURRENT_FRAME()) + 1);
OpenPOWER on IntegriCloud