[llvm-dev] JIT and atexit crash

Nikodemus Siivola via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 21 05:20:52 PST 2017


Transform the atexit into equivalent code you can control, run it before
the destructors of the JIT engine run?


On Tue, Nov 21, 2017 at 12:13 PM, Alex Denisov via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> > It's not the job of the Orc engine.
>
> I could argue about this, but I won’t :)
>
> > Just don't use atexit.
>
> The problem is that I run third-party programs. I cannot control them.
>
> > On 20. Nov 2017, at 01:04, Joerg Sonnenberger via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> >
> > On Mon, Nov 20, 2017 at 12:22:49AM +0100, Alex Denisov via llvm-dev
> wrote:
> >> JIT allocates and maps some memory for the execution. Some function X
> at address 0xdeadbeef is part of this memory.
> >> JIT calls a code that passes the X to atexit.
> >> JIT deallocates and unmaps the memory used for execution (either via
> objectLayer.removeObjectSet or by calling JIT's destructors)
> >> atexit (cxa_finalize_ranges) calls the X at 0xdeadbeef which does not
> belong to 'us' anymore, which leads to the crash.
> >
> > Sounds plausible.
> >
> >> Given that my assumption is correct what can we do about this? Is there
> >> anything that can be done to cover this case inside of the Orc engine?
> >
> > It's not the job of the Orc engine. Just don't use atexit.
> >
> > Joerg
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
> _______________________________________________
> 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/20171121/008ead0e/attachment.html>


More information about the llvm-dev mailing list