summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/scudo/valloc.cpp
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2017-09-14 20:34:32 +0000
committerKostya Kortchinsky <kostyak@google.com>2017-09-14 20:34:32 +0000
commit26e689f0c5ddef426e03336d1a88d37bd72de1dd (patch)
tree6773a824e91634422b26a352e75dccdf143b8890 /compiler-rt/test/scudo/valloc.cpp
parentf5870377d94bce70a5f66377cb5a27a9798147b9 (diff)
downloadbcm5719-llvm-26e689f0c5ddef426e03336d1a88d37bd72de1dd.tar.gz
bcm5719-llvm-26e689f0c5ddef426e03336d1a88d37bd72de1dd.zip
[scudo] Fix bad request handling when allocator has not been initialized
Summary: In a few functions (`scudoMemalign` and the like), we would call `ScudoAllocator::FailureHandler::OnBadRequest` if the parameters didn't check out. The issue is that if the allocator had not been initialized (eg: if this is the first heap related function called), we would use variables like `allocator_may_return_null` and `exitcode` that still had their default value (as opposed to the one set by the user or the initialization path). To solve this, we introduce `handleBadRequest` that will call `initThreadMaybe`, allowing the options to be correctly initialized. Unfortunately, the tests were passing because `exitcode` was still 0, so the results looked like success. Change those tests to do what they were supposed to. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37853 llvm-svn: 313294
Diffstat (limited to 'compiler-rt/test/scudo/valloc.cpp')
-rw-r--r--compiler-rt/test/scudo/valloc.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler-rt/test/scudo/valloc.cpp b/compiler-rt/test/scudo/valloc.cpp
index 010dac2a5ea..eef556f4653 100644
--- a/compiler-rt/test/scudo/valloc.cpp
+++ b/compiler-rt/test/scudo/valloc.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_scudo %s -o %t
-// RUN: %run %t valid 2>&1
-// RUN: %run %t invalid 2>&1
+// RUN: %run %t valid 2>&1
+// RUN: not %run %t invalid 2>&1
+// RUN: SCUDO_OPTIONS=allocator_may_return_null=1 %run %t invalid 2>&1
// Tests that valloc and pvalloc work as intended.
OpenPOWER on IntegriCloud