summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_stacktrace.h
diff options
context:
space:
mode:
authorSagar Thakur <sagar.thakur@imgtec.com>2016-05-18 06:09:26 +0000
committerSagar Thakur <sagar.thakur@imgtec.com>2016-05-18 06:09:26 +0000
commit92e12a694d81bfc1e585d3cff9083a9c63f84883 (patch)
treef9b6de3f69497588f912ee1bd40b29f3ce4c9993 /lib/sanitizer_common/sanitizer_stacktrace.h
parentf11f1f221425856494add602c44c4a9b8193bfe4 (diff)
downloadcompiler-rt-92e12a694d81bfc1e585d3cff9083a9c63f84883.tar.gz
[LSAN] Fix test swapcontext.cc on MIPS
There is no frame validity check in the slow unwinder like there is in the fast unwinder due to which lsan reports a leak even for heap allocated coroutine in the test swapcontext.cc. Since mips/linux uses slow unwindwer instead of fast unwinder, the test fails for mips/linux. Therefore adding the checks before unwinding fixes the test for mips/linux. Reviewed by aizatsky. Differential: http://reviews.llvm.org/D19961 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_stacktrace.h')
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_stacktrace.h b/lib/sanitizer_common/sanitizer_stacktrace.h
index 969cedb16..90142dffd 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace.h
+++ b/lib/sanitizer_common/sanitizer_stacktrace.h
@@ -110,6 +110,11 @@ struct BufferedStackTrace : public StackTrace {
void operator=(const BufferedStackTrace &);
};
+// Check if given pointer points into allocated stack area.
+static inline bool IsValidFrame(uptr frame, uptr stack_top, uptr stack_bottom) {
+ return frame > stack_bottom && frame < stack_top - 2 * sizeof (uhwptr);
+}
+
} // namespace __sanitizer
// Use this macro if you want to print stack trace with the caller