1 // RUN: %clangxx %s -fsanitize-memory-track-origins=1 -o %t
2 // RUN: %env_tool_opts="compress_stack_depot=0:malloc_context_size=128:verbosity=1" %run %t 2>&1 | FileCheck %s --implicit-check-not="StackDepot released"
3 // RUN: %env_tool_opts="compress_stack_depot=-1:malloc_context_size=128:verbosity=1" %run %t 2>&1 | FileCheck %s --check-prefixes=COMPRESS
4 // RUN: %env_tool_opts="compress_stack_depot=-2:malloc_context_size=128:verbosity=1" %run %t 2>&1 | FileCheck %s --check-prefixes=COMPRESS
5 // RUN: %env_tool_opts="compress_stack_depot=1:malloc_context_size=128:verbosity=1" %run %t 2>&1 | FileCheck %s --check-prefixes=COMPRESS,THREAD
6 // RUN: %env_tool_opts="compress_stack_depot=2:malloc_context_size=128:verbosity=1" %run %t 2>&1 | FileCheck %s --check-prefixes=COMPRESS,THREAD
8 // Ubsan does not store stacks.
11 // FIXME: Fails for unknown reason.
12 // UNSUPPORTED: target=s390x{{.*}}
14 // Similar to D114934, something is broken with background thread on THUMB and Asan.
15 // XFAIL: target=thumb{{.*}} && asan
17 #include <sanitizer/common_interface_defs.h>
21 __attribute__((noinline
)) void a(unsigned v
);
22 __attribute__((noinline
)) void b(unsigned v
);
24 std::unique_ptr
<int[]> p
;
26 __attribute__((noinline
)) void a(unsigned v
) {
30 p
.reset(new int[100]);
40 __attribute__((noinline
)) void b(unsigned v
) { return a(v
); }
42 int main(int argc
, char *argv
[]) {
43 for (unsigned i
= 0; i
< 100000; ++i
)
46 __sanitizer_sandbox_arguments args
= {0};
47 __sanitizer_sandbox_on_notify(&args
);
52 // THREAD: StackDepot compression thread started
53 // COMPRESS: StackDepot released {{[0-9]+}}
54 // THREAD: StackDepot compression thread stopped