History log of /haiku/src/system/runtime_loader/elf_tls.cpp
Revision Date Author Comments
# e7d37c7e 17-Dec-2018 Augustin Cavalier <waddlesplash@gmail.com>

Revert "runtime_loader: Add missing locking around resizing the TLS DTV."

This reverts commit d0111efeada9f21db085e0cc27abd94d408ddaa9.

Initially, I, too thought this was the correct solution. In
investigating the related #14342, I found that adding a lock of
the mutex in the function that crashed most often in (DestroyAll())
increased the time it took to cause a crash from 1-2 seconds
to 10-15 seconds, but it still inevitably crashed.

Further, crash addresses were often very low (e.g. 0x1, 0x18); on
inspection I determined these were coming from the fPointer fields
of TLSBlocks. But accesses to TLSBlocks were now well protected
by the TLS mutex, and they were memset'd after allocation, so that
didn't make any sense.

At that point, I went back and read over the code until I understood
it, and it became clear this solution was incorrect: TLSBlocks and
their underlying data are always associated with a specific thread,
meaning _Resize() and DestroyAll() would never be called on the same
data from different threads, despite appearances to the contrary.

Thus despite a dearth of comments in this file, it seems pdziepak
knew what he was doing when he wrote this; no locking is needed.
That left only one place to cause this kind of memory corruption...


# d0111efe 17-Dec-2018 Jérôme Duval <jerome.duval@gmail.com>

runtime_loader: Add missing locking around resizing the TLS DTV.

* Fixes crashes when the DTV is concurrently resized by multiple threads.
* Fixes JVM crash or endless loop when building OpenJDK.
* Should help with #13154, #14129, #14304, #14342.

Change-Id: I132600315d76a1a86236c6c70db09a3cdf0a8743
Reviewed-on: https://review.haiku-os.org/771
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>


# 368dd377 18-Oct-2014 Michael Lotz <mmlr@mlotz.ch>

runtime_loader: Fix missing include of util/kernel_cpp.h.

Due to the missing include, the builtin new and delete operators were
used in those two files instead of the ones from the include used
everywhere else in the runtime_loader.


# 680ca3b1 08-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: fix CID 1211995, improve generation counting

There is no need to increase generation counter each time new DSO is
registered.


# 44c0c4d3 03-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: add support for ELF based TLS

This patch introduces support of ELF based TLS handling with lazy allocation
and initalization of TLS block for each DSO and thread. The implementation
generally follows the official ABI except that generation counter in dtv
is in fact a pointer to Generation object that contains both generation
counter and size of the dtv. That simplified the implementation a bit, but
could be changed later. The ABI requirements regariding in memory position
of TLS block is not honoured what results in static TLS model being
unsupported. However, that should not be a problem as long as
"executables" in Haiku are in fact shared objects and optimizations which
require specific TLS block in memory layout are not possible anyway.


# 368dd377989a07862be20f87c23329734b2277d8 18-Oct-2014 Michael Lotz <mmlr@mlotz.ch>

runtime_loader: Fix missing include of util/kernel_cpp.h.

Due to the missing include, the builtin new and delete operators were
used in those two files instead of the ones from the include used
everywhere else in the runtime_loader.


# 680ca3b13d52422ea165f09173c82c8ba26e73c5 08-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: fix CID 1211995, improve generation counting

There is no need to increase generation counter each time new DSO is
registered.


# 44c0c4d3d0d68c3c3db23858b1089d3cf51bdf16 03-May-2014 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: add support for ELF based TLS

This patch introduces support of ELF based TLS handling with lazy allocation
and initalization of TLS block for each DSO and thread. The implementation
generally follows the official ABI except that generation counter in dtv
is in fact a pointer to Generation object that contains both generation
counter and size of the dtv. That simplified the implementation a bit, but
could be changed later. The ABI requirements regariding in memory position
of TLS block is not honoured what results in static TLS model being
unsupported. However, that should not be a problem as long as
"executables" in Haiku are in fact shared objects and optimizations which
require specific TLS block in memory layout are not possible anyway.