Geoff Levner via llvm-dev
2018-Sep-18 08:36 UTC
[llvm-dev] suggested bug fix in RTDyldObjectLinkingLayer
In certain circumstances, RTDyldObjectLinkingLayer dereferences a null pointer. Specifically, that happens if you add a linking object which, for some reason, is never finalized, and you specify a function to be called when objects are freed. Admittedly, that must not happen very often, but it can happen in our application, causing it to crash. Might I suggest the following patch? Geoff --- RTDyldObjectLinkingLayer.h (revision 342448) +++ RTDyldObjectLinkingLayer.h (working copy) @@ -175,7 +175,7 @@ } ~ConcreteLinkedObject() override { - if (this->Parent.NotifyFreed) + if (this->Parent.NotifyFreed && ObjForNotify.getBinary()) this->Parent.NotifyFreed(K, *ObjForNotify.getBinary()); MemMgr->deregisterEHFrames();
Alex Denisov via llvm-dev
2018-Sep-20 19:29 UTC
[llvm-dev] suggested bug fix in RTDyldObjectLinkingLayer
/cc Lang> On 18. Sep 2018, at 10:36, Geoff Levner via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > In certain circumstances, RTDyldObjectLinkingLayer dereferences a null > pointer. Specifically, that happens if you add a linking object which, > for some reason, is never finalized, and you specify a function to be > called when objects are freed. Admittedly, that must not happen very > often, but it can happen in our application, causing it to crash. > > Might I suggest the following patch? > > Geoff > > --- RTDyldObjectLinkingLayer.h (revision 342448) > +++ RTDyldObjectLinkingLayer.h (working copy) > @@ -175,7 +175,7 @@ > } > > ~ConcreteLinkedObject() override { > - if (this->Parent.NotifyFreed) > + if (this->Parent.NotifyFreed && ObjForNotify.getBinary()) > this->Parent.NotifyFreed(K, *ObjForNotify.getBinary()); > > MemMgr->deregisterEHFrames(); > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 529 bytes Desc: Message signed with OpenPGP URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180920/bd16ac41/attachment.sig>
Lang Hames via llvm-dev
2018-Sep-21 23:02 UTC
[llvm-dev] suggested bug fix in RTDyldObjectLinkingLayer
Hi Geoff, Thanks for catching that. I think your fix is the right one. I have committed it in r342783. Cheers, Lang. On Thu, Sep 20, 2018 at 12:29 PM Alex Denisov <1101.debian at gmail.com> wrote:> /cc Lang > > > On 18. Sep 2018, at 10:36, Geoff Levner via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > In certain circumstances, RTDyldObjectLinkingLayer dereferences a null > > pointer. Specifically, that happens if you add a linking object which, > > for some reason, is never finalized, and you specify a function to be > > called when objects are freed. Admittedly, that must not happen very > > often, but it can happen in our application, causing it to crash. > > > > Might I suggest the following patch? > > > > Geoff > > > > --- RTDyldObjectLinkingLayer.h (revision 342448) > > +++ RTDyldObjectLinkingLayer.h (working copy) > > @@ -175,7 +175,7 @@ > > } > > > > ~ConcreteLinkedObject() override { > > - if (this->Parent.NotifyFreed) > > + if (this->Parent.NotifyFreed && ObjForNotify.getBinary()) > > this->Parent.NotifyFreed(K, *ObjForNotify.getBinary()); > > > > MemMgr->deregisterEHFrames(); > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180921/7ec6b223/attachment.html>