[PATCH] D56521: Avoid use-after-free in ~LegacyRTDyldObjectLinkingLayer

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 10 12:16:02 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL350886: Avoid use-after-free in ~LegacyRTDyldObjectLinkingLayer (authored by sanjoy, committed by ).

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56521/new/

https://reviews.llvm.org/D56521

Files:
  llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h


Index: llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
===================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
@@ -443,11 +443,14 @@
 private:
   ExecutionSession &ES;
 
-  std::map<VModuleKey, std::unique_ptr<LinkedObject>> LinkedObjects;
   ResourcesGetter GetResources;
   NotifyLoadedFtor NotifyLoaded;
   NotifyFinalizedFtor NotifyFinalized;
   NotifyFreedFtor NotifyFreed;
+
+  // NB!  `LinkedObjects` needs to be destroyed before `NotifyFreed` because
+  // `~ConcreteLinkedObject` calls `NotifyFreed`
+  std::map<VModuleKey, std::unique_ptr<LinkedObject>> LinkedObjects;
   bool ProcessAllSections = false;
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56521.181128.patch
Type: text/x-patch
Size: 806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190110/351b461c/attachment.bin>


More information about the llvm-commits mailing list