diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-11-09 19:42:53 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-11-09 19:42:53 +0000 |
commit | b1e694b87e20a7164dc2ad993653ac5a0a3513ea (patch) | |
tree | df538dd263c0583b55f723ef0d933c332a963543 | |
parent | 02bbe41f54e2192c4767d079a967b7774aafa3c1 (diff) | |
download | bcm5719-llvm-b1e694b87e20a7164dc2ad993653ac5a0a3513ea.tar.gz bcm5719-llvm-b1e694b87e20a7164dc2ad993653ac5a0a3513ea.zip |
Revert rL346454: Fix a use-after-free introduced by r344915.
r344915 added a call to ApplyDebugLocation to the sanitizer check
function emitter. Some of the sanitizers are emitted in the function
epilogue though and the LexicalScopeStack is emptied out before. By
detecting this situation and early-exiting from ApplyDebugLocation the
fallback location is used, which is equivalent to the return location.
rdar://problem/45859802
........
Causes EXPENSIVE_CHECKS build bot failures: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win
llvm-svn: 346549
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/ubsan-debuglog-return.c | 10 |
2 files changed, 1 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 81cc07dddd1..1d999e446cc 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3538,7 +3538,7 @@ void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc) { // Update our current location setLocation(Loc); - if (CurLoc.isInvalid() || CurLoc.isMacroID() || LexicalBlockStack.empty()) + if (CurLoc.isInvalid() || CurLoc.isMacroID()) return; llvm::MDNode *Scope = LexicalBlockStack.back(); diff --git a/clang/test/CodeGen/ubsan-debuglog-return.c b/clang/test/CodeGen/ubsan-debuglog-return.c deleted file mode 100644 index 31f5ce2da58..00000000000 --- a/clang/test/CodeGen/ubsan-debuglog-return.c +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: %clang_cc1 -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s -// The UBSAN function call in the epilogue needs to have a debug location. - -__attribute__((returns_nonnull)) void *allocate() {} - -// CHECK: define nonnull i8* @allocate(){{.*}} !dbg -// CHECK: call void @__ubsan_handle_nonnull_return_v1_abort -// CHECK-SAME: !dbg ![[LOC:[0-9]+]] -// CHECK: ret i8* -// CHECK-SAME: !dbg ![[LOC]] |