summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/hwasan
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2019-10-18 22:36:25 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2019-10-18 22:36:25 +0000
commit0b7f320c3acb4ed75e5b3acf3460176b5b20b1aa (patch)
tree9c4619c14725d13bf4e8e746ac33c9b4d1587456 /compiler-rt/test/hwasan
parent8c8ec1f6868bd0f96801fabc55ea395d9d171f06 (diff)
downloadbcm5719-llvm-0b7f320c3acb4ed75e5b3acf3460176b5b20b1aa.tar.gz
bcm5719-llvm-0b7f320c3acb4ed75e5b3acf3460176b5b20b1aa.zip
[hwasan] Remove system allocator fallback.
Summary: This has been an experiment with late malloc interposition, made possible by a non-standard feature of the Android dynamic loader. Reviewers: pcc, mmalcomson Subscribers: srhines, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69199 llvm-svn: 375296
Diffstat (limited to 'compiler-rt/test/hwasan')
-rw-r--r--compiler-rt/test/hwasan/TestCases/Posix/system-allocator-fallback.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/compiler-rt/test/hwasan/TestCases/Posix/system-allocator-fallback.cpp b/compiler-rt/test/hwasan/TestCases/Posix/system-allocator-fallback.cpp
deleted file mode 100644
index 8678d906dae..00000000000
--- a/compiler-rt/test/hwasan/TestCases/Posix/system-allocator-fallback.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-// RUN: %clangxx %s -o %t -ldl
-// RUN: %clangxx_hwasan -shared %s -o %t.so -DSHARED_LIB -shared-libsan -Wl,-rpath,%compiler_rt_libdir
-// RUN: %env_hwasan_opts=disable_allocator_tagging=0 %run %t
-
-// The dynamic loader on Android O appears to have a bug where it crashes when
-// dlopening DF_1_GLOBAL libraries.
-// REQUIRES: android-28
-
-#include <stddef.h>
-
-// Test that allocations made by the system allocator can be realloc'd and freed
-// by the hwasan allocator.
-
-typedef void run_test_fn(void *(*system_malloc)(size_t size));
-
-#ifdef SHARED_LIB
-
-// Call the __sanitizer_ versions of these functions so that the test
-// doesn't require the Android dynamic loader.
-extern "C" void *__sanitizer_realloc(void *ptr, size_t size);
-extern "C" void __sanitizer_free(void *ptr);
-
-extern "C" run_test_fn run_test;
-void run_test(void *(*system_malloc)(size_t size)) {
- void *mem = system_malloc(64);
- mem = __sanitizer_realloc(mem, 128);
- __sanitizer_free(mem);
-}
-
-#else
-
-#include <dlfcn.h>
-#include <stdlib.h>
-#include <string>
-
-int main(int argc, char **argv) {
- std::string path = argv[0];
- path += ".so";
- void *lib = dlopen(path.c_str(), RTLD_NOW);
- if (!lib) {
- printf("error in dlopen(): %s\n", dlerror());
- return 1;
- }
-
- auto run_test = reinterpret_cast<run_test_fn *>(dlsym(lib, "run_test"));
- if (!run_test) {
- printf("failed dlsym\n");
- return 1;
- }
-
- run_test(malloc);
-}
-
-#endif
OpenPOWER on IntegriCloud