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

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 9 16:25:42 PST 2019


sanjoy created this revision.
sanjoy added a reviewer: lhames.
Herald added subscribers: bixia, jlebar, mcrosier.

Repository:
  rL LLVM

https://reviews.llvm.org/D56521

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


Index: include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
===================================================================
--- include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
+++ 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.180959.patch
Type: text/x-patch
Size: 773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190110/b3383540/attachment.bin>


More information about the llvm-commits mailing list