Hardened Malloc

From Whonix


Hardened Malloc | Hardened Malloc Kicksecure ™ Fork


Hardened Malloc is a hardened memory allocator which can be used with many applications to increase security.

According to the author's GitHub description: [1]

This is a security-focused general purpose memory allocator providing the malloc API along with various extensions. It provides substantial hardening against heap corruption vulnerabilities. The security-focused design also leads to much less metadata overhead and memory waste from fragmentation than a more traditional allocator design. It aims to provide decent overall performance with a focus on long-term performance and memory usage rather than allocator micro-benchmarks. It offers scalability via a configurable number of entirely independently arenas, with the internal locking within arenas further divided up per size class.

Readers who wish to discuss the integration of Hardened Malloc with Whonix ™ should refer to this forum thread [archive].


Hardened Malloc is pre-installed on the Whonix ™ and Kicksecure ™.

Hardened Malloc is available from the Whonix ™ and Kicksecure ™ APT repository. [2] Users of these Linux distributions can install it easily with the following instructions.

Users of Debian (-based) Linux distributions other than Whonix ™ or Kicksecure ™ need to first add the Whonix ™ APT repository, which is documented on the Packages for Debian Hosts wiki page. For other distributions, refer to the Hardened Malloc Manual Installation instructions.

Install hardened-malloc.

1. Update the package lists.

sudo apt update

2. Upgrade the system.

sudo apt full-upgrade

3. Install the hardened-malloc package.

Using apt command line parameter --no-install-recommends is in most cases optional.

sudo apt install --no-install-recommends hardened-malloc

4. Done.

The procedure of installing hardened-malloc is complete.

How-to: Launch Applications with Hardened Malloc[edit]

Testers only! Testers only!

Systemd Services[edit]

To launch individual systemd services with hardened malloc, add a drop-in systemd configuration snippet.


Other Applications[edit]

To launch other applications with Hardened Malloc, the LD_PRELOAD environment variable must be edited before starting the application. For example, to launch application-name in this way, run.

LD_PRELOAD='/usr/lib/' application-name

All Applications by Default[edit]

Note: This action may break numerous applications such as man, apt or Xorg.

It is possible to make all applications use Hardened Malloc as the default memory allocator. To configure this option, the path to the library must be added to the /etc/ file. [3]

1. Open file /etc/ in an editor with root rights.

This box uses sudoedit for better security [archive]. This is an example and other tools can also achieve the same goal. If this example does not work for you or if you are not using Whonix ™, please refer to this link.

sudoedit /etc/

2. Add the library.


3. Save the file.

The procedure is complete.

Incompatible Applications[edit]


Using Hardened Malloc with Tor Browser or Firefox is difficult and unsupported. [4]

It is unknown whether other browsers can benefit from Hardened Malloc.


Other applications might not easily benefit from Hardened Malloc for the same reasons outlined in the browsers section above.

Whether an application can benefit from Hardened Malloc or not depends on technical implementation details of the application in question. Vendors of applications will probably know if their application is compatible with Hardened Malloc. Community wiki contributions are most welcome -- please post any additional vendor Q&As here.

Credits and Source Code[edit]

The original [archive] source software is maintained by security researcher, Daniel Micay.

This website [archive] is the software fork [archive] homepage for Hardened Malloc, with a focus on easy installation, added user documentation, and integration with Whonix, Kicksecure, Debian, and other distributions. The Whonix ™ software fork source code can be found here [archive]. Continuous integration: travis CI [archive]


  1. [archive]
  2. [archive]
  3. feature request: /etc/ drop-in configuration folder support [archive]
  4. Tor Browser is also based on Firefox, therefore the following advice equally applies.

    LD_PRELOAD='/path/to/' /path/to/program will do nothing or approximately nothing.

    The reason is recompilation is necessary.

    To successfully replace Firefox memory allocator you should either use LD_PRELOAD _with_ a --disable-jemalloc build OR Firefox's replace_malloc functionality: [archive]


Fosshost is sponsors Kicksecure ™ stage server 100px
Fosshost About Advertisements

Search engines: YaCy | Qwant | ecosia | MetaGer | peekier | Whonix ™ Wiki

Follow: 1024px-Telegram 2019 Logo.svg.png Iconfinder Apple Mail 2697658.png Twitter.png Facebook.png Rss.png Reddit.jpg 200px-Mastodon Logotype (Simple).svg.png

Support: Discourse logo.png

Donate: Donate Bank Wire Paypal Bitcoin accepted here Monero accepted here Contribute

Whonix donate bitcoin.png Monero donate Whonix.png United Federation of Planets 1000px.png

Twitter-share-button.png Facebook-share-button.png Telegram-share.png link=mailto:?subject=Hardened Malloc&body= link= Malloc link= Malloc link= Malloc%20 Malloc

Check out the Whonix ™ News Blog. Rss.png

https link onion link Priority Support | Investors | Professional Support

Whonix | © ENCRYPTED SUPPORT LP | Heckert gnu.big.png Freedom Software / Osi standard logo 0.png Open Source (Why?)

The personal opinions of moderators or contributors to the Whonix ™ project do not represent the project as a whole.