[compiler-rt] r195243 - [asan] Test that LargeAllocator unpoisons memory before releasing it to the OS.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed Nov 20 04:49:53 PST 2013


Author: eugenis
Date: Wed Nov 20 06:49:53 2013
New Revision: 195243

URL: http://llvm.org/viewvc/llvm-project?rev=195243&view=rev
Log:
[asan] Test that LargeAllocator unpoisons memory before releasing it to the OS.

Added:
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/large_allocator_unpoisons_on_free.cc   (with props)

Added: compiler-rt/trunk/lib/asan/lit_tests/TestCases/large_allocator_unpoisons_on_free.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/large_allocator_unpoisons_on_free.cc?rev=195243&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/large_allocator_unpoisons_on_free.cc (added)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/large_allocator_unpoisons_on_free.cc Wed Nov 20 06:49:53 2013
@@ -0,0 +1,23 @@
+// Test that LargeAllocator unpoisons memory before releasing it to the OS.
+// RUN: %clangxx_asan %s -o %t
+// RUN: ASAN_OPTIONS=quarantine_size=1 %t
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+
+int main() {
+  void *p = malloc(1024 * 1024);
+  free(p);
+
+  char *q = (char *)mmap(p, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+  assert(q);
+  assert(q <= p);
+  assert(q + 4096 > p);
+
+  memset(q, 42, 4096);
+
+  munmap(q, 4096);
+  return 0;
+}

Propchange: compiler-rt/trunk/lib/asan/lit_tests/TestCases/large_allocator_unpoisons_on_free.cc
------------------------------------------------------------------------------
    svn:eol-style = LF





More information about the llvm-commits mailing list