[llvm-commits] [PATCH] Avoid use after free in ScalarEvolution

Dan Gohman gohman at apple.com
Mon Jun 15 11:15:27 PDT 2009


Hi Edwin,

WritingAnLLVMPass.htm's description of releaseMemory says "This method  
is
called after the run* method for the class, before the next call of run*
in your pass."  This suggests that it's a bug in the PassManager for not
calling releaseMemory for on-the-fly analyses.

On the other hand, I do see several other existing passes calling
releaseMemory or the equivalent at the top of their run functions.

Dan

On May 22, 2009, at 3:41 AM, Török Edwin wrote:


> Hi,
>
> When running ScalarEvolution on-the-fly (from a ModulePass), and using
> getSCEVAtScope I get use-after-free errors.
> This is because nobody calls releaseMemory() for ScalarEvolution  
> before
> running it again, and LoopInfo has already been run for the new  
> function
> , hence freeing the loopinfo of the previous function.  But
> ScalarEvolution still has Loop* in ValuesAtScopes (and other maps),
> which cause use-after-free errors.
>
> The attached patch simply adds a call to releaseMemory().
> OK to commit?
>
> Or should the on-the-fly passmanager call releaseMemory before  
> rerunning
> the pass?
>
> Best regards,
> --Edwin
>
> <scev.patch>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>






More information about the llvm-commits mailing list