History log of /haiku/src/system/libroot/posix/malloc_debug/Jamfile
Revision Date Author Comments
# b3e749b0 28-May-2018 Jérôme Duval <jerome.duval@gmail.com>

kernel,libroot,boot: remove c++11 and gnu++11 flags.

* c++14 is the default with current GCC
* remove pragmas for x86intrin.h


# f474606e 12-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

libroot_debug: Merge guarded heap into libroot_debug.

The individual debug heap implementations are now exposed via a
structure of function pointers and a common frontend dispatches the
malloc and malloc_debug APIs through them.

The MALLOC_DEBUG environment variable can be used to select the guarded
heap by adding 'g', otherwise the debug heap is used as the default.
Consequently the separate libroot_guarded is not needed anymore and has
been removed.

To allow the use of environment variables this early, init_env_post_heap
has been added and the heap dependent atfork() moved there. This allowed
to fold the code of init_heap_post_env into init_heap so the former has
been removed.


# bd5dea31 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

guarded_heap: Replace symbol lookup syscall with runtime_loader.

Use the private runtime_loader API to do the symbol lookup instead of
using the syscall.


# 0cf3d621 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

Make guarded heap accessible through its own libroot_guarded.so.

This adds libroot_guarded.so to the HaikuDevel package. It is the same
as libroot_debug with the debug heap swapped out for the guarded heap.
The guarded heap has some useful features that make it desirable to use
while having the disadvantage of a large memory and address space
overhead which make it unusable in some situations. Therefore the
guarded heap cannot simply replace the debug heap but should still be
made available. As the heap init needs to happen even before having
environment variables, the heap to use can not be chosen dynamically.
Exposing them through their own libraries is the next best thing.


# abf230a9 07-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

malloc_debug: Set default alignment to max_align_t if available.

For it to be available we build malloc_debug in C++11 mode when not
using GCC2. Note that max_align_t is not in the std namespace in GCC4
versions prior to GCC 4.9. The extra "using namespace std" is there to
be forward compatible once we update.


# b0944c78 01-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

More work towards hybrid support

* All packaging architecture dependent variables do now have a
respective suffix and are set up for each configured packaging
architecture, save for the kernel and boot loader variables, which
are still only set up for the primary architecture.
For convenience TARGET_PACKAGING_ARCH, TARGET_ARCH, TARGET_LIBSUPC++,
and TARGET_LIBSTDC++ are set to the respective values for the primary
packaging architecture by default.
* Introduce a set of MultiArch* rules to help with building targets for
multiple packaging architectures. Generally the respective targets are
(additionally) gristed with the packaging architecture. For libraries
the additional grist is usually omitted for the primary architecture
(e.g. libroot.so and <x86>libroot.so for x86_gcc2/x86 hybrid), so that
Jamfiles for targets built only for the primary architecture don't
need to be changed.
* Add multi-arch build support for all targets needed for the stage 1
cross devel package as well as for libbe (untested).


# 97680106 06-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add a userland version of the guarded heap to libroot_debug.

The guarded heap uses mprotect() to protect freed/unallocated pages so
that any access to such a page results in a segfault. It also installs
a segfault handler that in such an event prints some info about the
accessed page and then calls the debugger with a meaningful message.

It implements the same interface as the debug heap so it can simply be
swapped out by changing the Jamfile. As it doesn't support most of the
extra debug features (wall checking is obviously superfluous, but it
also doesn't help in leak checking) and as it is hugely space
inefficient I left it disabled for now.


# ae901935 24-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Introduce __set_errno() throughout libroot.

* add errno_private.h, which defines the __set_errno() macro with
and without tracing
* instead of setting errno manually, all libroot's code now invokes
__set_errno(), which makes it much easier to trace changes to errno
* redirect glibc's use of __set_errno() to our own version


# 448671a3 27-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Build library libroot_debug.so, which is the standard libroot.so with the
debug heap implementation.
* Added libroot_debug.so to the DevelopmentMin optional package. Since it has
the same soname as the standard libroot, it can simply be specified in
LD_PRELOAD to run a program with that version.


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


# 3bb69a82 12-Oct-2009 Michael Lotz <mmlr@mlotz.ch>

* Use mutex and rw_lock and the proper AutoLockers as in the kernel version, as
these interfaces are now available.
* Don't be quite so paranoid by default, the checks that are on by default
should be enough to detect most memory corruptions.

This makes the debug heap way more usable, so much that you can even use it as
your normal everyday heap without noticing much performance impact (it has quite
a bit of additional memory overhead though).


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


# 185fd1c5 01-Sep-2009 Michael Lotz <mmlr@mlotz.ch>

Ported over the kernel heap to libroot to make use of it's validation
capabilities to aid in debugging memory corruption issues.

It does:
* Initialize memory to 0xcc to help turn up use of uninitialized memory
* Set freed memory to 0xdeadbeef to help find accesses of freed memory
* Use the paranoid heap validation to turn up many cases of memory corruption
* Use a simplistic wall check to turn up memory overwrites past allocations
* Take extra steps to validate freed addresses to turn up misaligned frees

It has an interface to en-/disable paranoid validation and to start/stop regular
wall checking. Both are currently just enabled. At a later stage a debug version
of libroot could be used by an application and the checks enabled at will. Note
that due to the paranoid validation and the suboptimal locking this allocator
will perform horribly. Still to find memory corruption issues in the system or
also in your applications it can be helpful to build your installation with it
turned on. To enable it you currently need to edit the Jamfile to sub-include
the malloc_debug instead of the malloc directory.


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


# f474606ee92a7afddb5b3b6350a97ffd31e22c42 12-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

libroot_debug: Merge guarded heap into libroot_debug.

The individual debug heap implementations are now exposed via a
structure of function pointers and a common frontend dispatches the
malloc and malloc_debug APIs through them.

The MALLOC_DEBUG environment variable can be used to select the guarded
heap by adding 'g', otherwise the debug heap is used as the default.
Consequently the separate libroot_guarded is not needed anymore and has
been removed.

To allow the use of environment variables this early, init_env_post_heap
has been added and the heap dependent atfork() moved there. This allowed
to fold the code of init_heap_post_env into init_heap so the former has
been removed.


# bd5dea318a091a3ff074ed1823cd961473177c9a 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

guarded_heap: Replace symbol lookup syscall with runtime_loader.

Use the private runtime_loader API to do the symbol lookup instead of
using the syscall.


# 0cf3d62115e3f1cce1d0165e603cab3b84e18f2f 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

Make guarded heap accessible through its own libroot_guarded.so.

This adds libroot_guarded.so to the HaikuDevel package. It is the same
as libroot_debug with the debug heap swapped out for the guarded heap.
The guarded heap has some useful features that make it desirable to use
while having the disadvantage of a large memory and address space
overhead which make it unusable in some situations. Therefore the
guarded heap cannot simply replace the debug heap but should still be
made available. As the heap init needs to happen even before having
environment variables, the heap to use can not be chosen dynamically.
Exposing them through their own libraries is the next best thing.


# abf230a9ac4750f4cacfb1d4c8610732c15b417c 07-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

malloc_debug: Set default alignment to max_align_t if available.

For it to be available we build malloc_debug in C++11 mode when not
using GCC2. Note that max_align_t is not in the std namespace in GCC4
versions prior to GCC 4.9. The extra "using namespace std" is there to
be forward compatible once we update.


# b0944c78b074a8110bd98e060415d0e8f38a7f65 01-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

More work towards hybrid support

* All packaging architecture dependent variables do now have a
respective suffix and are set up for each configured packaging
architecture, save for the kernel and boot loader variables, which
are still only set up for the primary architecture.
For convenience TARGET_PACKAGING_ARCH, TARGET_ARCH, TARGET_LIBSUPC++,
and TARGET_LIBSTDC++ are set to the respective values for the primary
packaging architecture by default.
* Introduce a set of MultiArch* rules to help with building targets for
multiple packaging architectures. Generally the respective targets are
(additionally) gristed with the packaging architecture. For libraries
the additional grist is usually omitted for the primary architecture
(e.g. libroot.so and <x86>libroot.so for x86_gcc2/x86 hybrid), so that
Jamfiles for targets built only for the primary architecture don't
need to be changed.
* Add multi-arch build support for all targets needed for the stage 1
cross devel package as well as for libbe (untested).


# 97680106f0ecd95f5f8ca7e1aeb33992fba42ccb 06-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add a userland version of the guarded heap to libroot_debug.

The guarded heap uses mprotect() to protect freed/unallocated pages so
that any access to such a page results in a segfault. It also installs
a segfault handler that in such an event prints some info about the
accessed page and then calls the debugger with a meaningful message.

It implements the same interface as the debug heap so it can simply be
swapped out by changing the Jamfile. As it doesn't support most of the
extra debug features (wall checking is obviously superfluous, but it
also doesn't help in leak checking) and as it is hugely space
inefficient I left it disabled for now.


# ae9019359606f1db67632ef51a77ce70001d3770 24-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Introduce __set_errno() throughout libroot.

* add errno_private.h, which defines the __set_errno() macro with
and without tracing
* instead of setting errno manually, all libroot's code now invokes
__set_errno(), which makes it much easier to trace changes to errno
* redirect glibc's use of __set_errno() to our own version


# 448671a39cda3aa5508a6071d71e9d5e0d23a3e6 27-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Build library libroot_debug.so, which is the standard libroot.so with the
debug heap implementation.
* Added libroot_debug.so to the DevelopmentMin optional package. Since it has
the same soname as the standard libroot, it can simply be specified in
LD_PRELOAD to run a program with that version.


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


# 3bb69a8235d2f552a680d9f48d4a47dc3fe7eee4 12-Oct-2009 Michael Lotz <mmlr@mlotz.ch>

* Use mutex and rw_lock and the proper AutoLockers as in the kernel version, as
these interfaces are now available.
* Don't be quite so paranoid by default, the checks that are on by default
should be enough to detect most memory corruptions.

This makes the debug heap way more usable, so much that you can even use it as
your normal everyday heap without noticing much performance impact (it has quite
a bit of additional memory overhead though).


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


# 185fd1c5d288172e07a6d33e3b3c2bc815ba05af 01-Sep-2009 Michael Lotz <mmlr@mlotz.ch>

Ported over the kernel heap to libroot to make use of it's validation
capabilities to aid in debugging memory corruption issues.

It does:
* Initialize memory to 0xcc to help turn up use of uninitialized memory
* Set freed memory to 0xdeadbeef to help find accesses of freed memory
* Use the paranoid heap validation to turn up many cases of memory corruption
* Use a simplistic wall check to turn up memory overwrites past allocations
* Take extra steps to validate freed addresses to turn up misaligned frees

It has an interface to en-/disable paranoid validation and to start/stop regular
wall checking. Both are currently just enabled. At a later stage a debug version
of libroot could be used by an application and the checks enabled at will. Note
that due to the paranoid validation and the suboptimal locking this allocator
will perform horribly. Still to find memory corruption issues in the system or
also in your applications it can be helpful to build your installation with it
turned on. To enable it you currently need to edit the Jamfile to sub-include
the malloc_debug instead of the malloc directory.


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