[Pkg-openssl-devel] Bug#870018: Bug#870018: openssl: SIGSEGV/coredump on process stop when TLS is enabled in kamailio
Kurt Roeckx
kurt at roeckx.be
Thu Aug 3 02:02:55 UTC 2017
reassign 870018 kamailio
thanks
On Wed, Aug 02, 2017 at 05:01:01PM +0200, Guillem Jover wrote:
> Control: tags -1 patch
>
> Hi!
>
> On Sat, 2017-07-29 at 09:11:53 +0200, Kurt Roeckx wrote:
> > On Sat, Jul 29, 2017 at 12:12:16AM +0200, Michael Prokop wrote:
> > > Kurt, do you have any ideas what might go wrong in OPENSSL_cleanup
> > > here and how this could be fixed? We'd appreciate any hints. Thanks!
>
> > I don't see anything obvious wrong. From what I understand it
> > calls exit(0) from a SIGTERM handler.
> >
> > The only suggestion I have is that you try to run this under
> > valgrind or something.
> >
> > Also feel free to open a github issue about this.
>
> I was checking this, and my initial hypothesis which I've not yet
> confirmed, but seems completely spot on, given the documentation I've
> just read about OPENSSL_cleanup() is that something within the pthreads
> library is releasing the memory pool for the affected variable that is
> segfaulting in OpenSSL, and when the OpenSSL atexit() handler gets
> called the pthreads variable is already gone.
>
> The attached patch fixes the segfault for me, and seems to be in line
> with the recommendations in the OPENSSL_cleanup() docs. I should
> probably update the comment further. And I guess this report should be
> reassigned to the kamailio package then.
>
> I'm not sure whether calling OPENSSL_thread_stop() would be more
> correct here, as I don't know how threads are being used, and how the
> TLS module interacts with the rest of the codebase, etc.
>From reading the documentation, I think OPENSSL_thread_stop()
should have been called because otherwise it doesn't know it's
variable already got removed. So I'm reassigning it.
Kurt
More information about the Pkg-openssl-devel
mailing list