diff --git a/documentation/hardened_malloc.xhtml b/documentation/hardened_malloc.xhtml index e69e17e..72c7af2 100644 --- a/documentation/hardened_malloc.xhtml +++ b/documentation/hardened_malloc.xhtml @@ -1,7 +1,7 @@ - + @@ -62,44 +62,45 @@

Increase Permitted Amount of Memory Pages

-

Add vm.max_map_count = 1048576 to /etc/sysctl.conf to accommodate - hardened_malloc's large amount of guard pages.

+

Add the following to /etc/sysctl.conf or a configuration file within + /etc/sysctl.d/to accommodate hardened_malloc's large amount of guard pages:

+
vm.max_map_count = 1048576

Clone hardened_malloc Source Code

-

$ git clone https://github.com/GrapheneOS/hardened_malloc.git

+
$ git clone https://github.com/GrapheneOS/hardened_malloc.git

Enter hardened_malloc Local Git Repository

-

$ cd hardened_malloc/

+
$ cd hardened_malloc/

Compile hardened_malloc

-

$ make <arguments>

+
$ make <arguments>

CONFIG_N_ARENA=n can be adjusted to increase parallel performance at the expense of memory usage, or decrease memory usage at the expense of parallel performance, where n is a non-negative integer. Higher values prefer parallel performance, whereas lower values prefer lower memory usage. Note that having too many arenas may cause memory fragmentation and decrease system performance. The number of arenas has no impact on the security properties of hardened_malloc.

-
- - - - - - - - - - - - - - - -
MinimumMaximumDefault
12564
-
+
+ + + + + + + + + + + + + + + +
MinimumMaximumDefault
12564
+

For extra security, CONFIG_SEAL_METADATA=true can be used in order to control whether Memory Protection Keys @@ -108,23 +109,26 @@ current-generation hardware. Whether or not this feature is enabled, the metadata is all contained within an isolated memory region with high-entropy random guard regions around it.

For low-memory systems, VARIANT=light can be used to compile the light variant of - hardened_malloc, which sacrifices some security for much less memory usage. This option still - produces a more hardened memory allocator than both the default musl and glibc allocators, despite - the security sacrifices over the full variant.

+ hardened_malloc, which sacrifices some security for less memory usage. This option still produces a + more hardened memory allocator than both the default musl and glibc allocators, despite the security + sacrifices over the full variant.

For all compile-time options, see the configuration section of hardened_malloc's official documentation.

Copy Compiled hardened_malloc Library

-

# cp out/libhardened_malloc.so /usr/local/lib/libhardened_malloc.so

+
# cp out/libhardened_malloc.so /usr/local/lib/libhardened_malloc.so

Set System to Preload hardened_malloc on Boot

-

musl-based systems: Add LD_PRELOAD=/usr/local/lib/libhardened_malloc.so to - /etc/environment

-

glibc-based systems: Add /usr/local/lib/libhardened_malloc.so to - /etc/ld.so.preload

+

In order to preload the hardened_malloc shared library on boot, perform the following + actions:

+

musl-based systems: Add the following to /etc/environment or a configuration + file within /etc/environment.d/:

+
LD_PRELOAD=/usr/local/lib/libhardened_malloc.so
+

glibc-based systems: Add the following to /etc/ld.so.preload:

+
/usr/local/lib/libhardened_malloc.so
Sitemap