[compiler-rt] r311421 - [libFuzzer] fix the stack-depth initialization, add a lit test for DeepRecursionTest.cpp
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 21 18:50:00 PDT 2017
Author: kcc
Date: Mon Aug 21 18:50:00 2017
New Revision: 311421
URL: http://llvm.org/viewvc/llvm-project?rev=311421&view=rev
Log:
[libFuzzer] fix the stack-depth initialization, add a lit test for DeepRecursionTest.cpp
Added:
compiler-rt/trunk/test/fuzzer/deep-recursion.test
Modified:
compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp?rev=311421&r1=311420&r2=311421&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp Mon Aug 21 18:50:00 2017
@@ -343,8 +343,10 @@ void TracePC::ClearInlineCounters() {
}
}
+ATTRIBUTE_NO_SANITIZE_ALL
void TracePC::RecordInitialStack() {
- InitialStack = __sancov_lowest_stack;
+ int stack;
+ __sancov_lowest_stack = InitialStack = reinterpret_cast<uintptr_t>(&stack);
}
uintptr_t TracePC::GetMaxStackOffset() const {
Added: compiler-rt/trunk/test/fuzzer/deep-recursion.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/deep-recursion.test?rev=311421&view=auto
==============================================================================
--- compiler-rt/trunk/test/fuzzer/deep-recursion.test (added)
+++ compiler-rt/trunk/test/fuzzer/deep-recursion.test Mon Aug 21 18:50:00 2017
@@ -0,0 +1,4 @@
+# Test that we can find a stack overflow
+RUN: %cpp_compiler -fsanitize-coverage=stack-depth %S/DeepRecursionTest.cpp -o %t
+RUN: not %t -seed=1 -runs=100000000 2>&1 | FileCheck %s
+CHECK: ERROR: libFuzzer: deadly signal
More information about the llvm-commits
mailing list