r346549 - Revert rL346454: Fix a use-after-free introduced by r344915.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 9 11:42:53 PST 2018


Author: rksimon
Date: Fri Nov  9 11:42:53 2018
New Revision: 346549

URL: http://llvm.org/viewvc/llvm-project?rev=346549&view=rev
Log:
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

Removed:
    cfe/trunk/test/CodeGen/ubsan-debuglog-return.c
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=346549&r1=346548&r2=346549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Nov  9 11:42:53 2018
@@ -3538,7 +3538,7 @@ void CGDebugInfo::EmitLocation(CGBuilder
   // Update our current location
   setLocation(Loc);
 
-  if (CurLoc.isInvalid() || CurLoc.isMacroID() || LexicalBlockStack.empty())
+  if (CurLoc.isInvalid() || CurLoc.isMacroID())
     return;
 
   llvm::MDNode *Scope = LexicalBlockStack.back();

Removed: cfe/trunk/test/CodeGen/ubsan-debuglog-return.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ubsan-debuglog-return.c?rev=346548&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/ubsan-debuglog-return.c (original)
+++ cfe/trunk/test/CodeGen/ubsan-debuglog-return.c (removed)
@@ -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]]




More information about the cfe-commits mailing list