History log of /haiku/src/system/runtime_loader/heap.cpp
Revision Date Author Comments
# 06a78d0d 09-Mar-2021 Jérôme Duval <jerome.duval@gmail.com>

runtime_loader: set default alignment to max_align_t if available

...as done by mmlr in malloc_debug.
TLS blocks are expected to be aligned, gcc happily uses SSE instructions,
triggering exceptions.

Change-Id: I5a7bfe287600286e724cd13fe9aa7c7916091979
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3768
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 32560010 18-Dec-2018 Augustin Cavalier <waddlesplash@gmail.com>

runtime_loader: Reinit the heap lock after fork.


# df3de479 17-Dec-2018 Augustin Cavalier <waddlesplash@gmail.com>

runtime_loader: Make the heap thread-safe.

Previously we didn't need to care about threading in here, as it
was used only up to the point where the application's _start was called
and then libroot's heap would take over. But with the introduction of TLS
support by pdziepak in 2014, we also handle TLS bookkeeping inside
runtime_loader, and so this heap needs to be thread-safe.

Properly fixes the JVM crashes korli was attempting to fix in hrev52658,
and fixes #13154, #14129, #14304, #14342 for real.


# 28d3c8ca 26-Dec-2015 Michael Lotz <mmlr@mlotz.ch>

runtime_loader: Resync heap impl with the one of the bootloader.

The heap implementation of the runtime_loader was switched to the one
of the bootloader in 6f0994d but was since updated independently.

To keep the diff between the two implementations as small as possible,
the bootloader implementation was first copied to the runtime_loader
and then some features not relevant in the runtime_loader (like the
special large allocation handling) have been removed and the
runtime_loader specific features (grow_heap, add_area) have been
reintegrated. But basically this applies 96689a5..HEAD of
src/system/boot/loader/heap.cpp to the runtime_loader heap.

This brings in the switch from a linked list to a splay tree based
free chunk management. Since the allocation counts in the runtime_loader
are rather small, this does not perceptibly affect performance in either
direction though.


# 8bbfae7b 26-Dec-2015 Michael Lotz <mmlr@mlotz.ch>

runtime_loader: Fix endless rld heap grow loop in edge case.

The needed storage space for tracking the allocation size was not
accounted for when growing the heap. Since the growth size is always
rounded up to a multiple of 32KiB, this did almost never matter as the
new allocation wouldn't need the full size. If the allocation did
happen to need the full size however, the newly added area would always
be too small. As the allocation attempt was simply restarted after each
successful growth, this lead to an endless loop creating small new
areas, which would then quickly starve the system for memory.


# 9f3bd497 15-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: explicitly randomize rld_heap and _rld_debug_ positions


# 12b3e8a8 28-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support x86_64 in the runtime loader.

* Added x86_64 linker script and relocation code.
* Some 64-bit safety fixes to the heap code.
* Added runtime_loader, libroot and bash to the x86_64 image. The boot
script will be launched, but will panic shortly after because fork
is broken.


# 33f0ed7a 10-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Revert hrev43457.

This reverts commit 82929f8a76b4a5f185f9f39cbec3eb42ace7fc06.


# 8eff10a8 10-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Revert hrev43458.

This reverts commit 80e6a84bf008b3479413d37737f1889bd2a02905.


# 80e6a84b 10-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Fix alignment mask, sorry for the noise.


# 82929f8a 10-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add a simplistic memalign() to the runtime_loader heap.

As KMessage now makes use of memalign() the simple heap in the
runtime_loader needs to provide that as well. Fixes build.


# f68fa9d3 01-Nov-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented realloc().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28454 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74c0424a 26-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
compile with _LOADER_MODE defined.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5cfd3a15 11-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

The heap now grows if needed; this allows VLC to load all of its plugins.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19046 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f0994d4 11-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* Switched to the boot loader's heap implementation.
* This sane heap revealed a bunch of bugs (like sLoadedImageCount not being
maintained that was used for various allocations).
* If the allocation of the image fails, opening the app will now just fail
instead of crashing of overwriting random data (IOW VLC will now load
okay, but cannot load some of its add-ons anymore).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19045 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9f3bd49737df7fedbf89ed90570ac1a965814c2b 15-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

runtime_loader: explicitly randomize rld_heap and _rld_debug_ positions


# 12b3e8a8a01e04da03da98410425695880e96347 28-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support x86_64 in the runtime loader.

* Added x86_64 linker script and relocation code.
* Some 64-bit safety fixes to the heap code.
* Added runtime_loader, libroot and bash to the x86_64 image. The boot
script will be launched, but will panic shortly after because fork
is broken.


# 33f0ed7a03b771eddca8687e97554a4831416cea 10-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Revert hrev43457.

This reverts commit 82929f8a76b4a5f185f9f39cbec3eb42ace7fc06.


# 8eff10a8bfd597cbbf61301e605694e7230e91c7 10-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Revert hrev43458.

This reverts commit 80e6a84bf008b3479413d37737f1889bd2a02905.


# 80e6a84bf008b3479413d37737f1889bd2a02905 10-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Fix alignment mask, sorry for the noise.


# 82929f8a76b4a5f185f9f39cbec3eb42ace7fc06 10-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add a simplistic memalign() to the runtime_loader heap.

As KMessage now makes use of memalign() the simple heap in the
runtime_loader needs to provide that as well. Fixes build.


# f68fa9d36488b6c88e06d509cb9694ed03b4084a 01-Nov-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented realloc().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28454 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74c0424a43b550536d4b55b8fc13631ca4edfcb0 26-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
compile with _LOADER_MODE defined.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5cfd3a15924fa65a29f361b793b046e711cead16 11-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

The heap now grows if needed; this allows VLC to load all of its plugins.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19046 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f0994d460af36fdf620ec1dc627d965f304f364 11-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* Switched to the boot loader's heap implementation.
* This sane heap revealed a bunch of bugs (like sLoadedImageCount not being
maintained that was used for various allocations).
* If the allocation of the image fails, opening the app will now just fail
instead of crashing of overwriting random data (IOW VLC will now load
okay, but cannot load some of its add-ons anymore).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19045 a95241bf-73f2-0310-859d-f6bbb57e9c96