forked from security/wiki
Merge pull request 'Revise hardened_malloc page and update it for 12-3' (#9) from solardiz-patch-7 into main
Reviewed-on: security/wiki#9 Reviewed-by: Neil Hanlon <neil@noreply@resf.org>
This commit is contained in:
commit
9b24cfd2e1
@ -2,7 +2,7 @@
|
||||
|
||||
## EL9
|
||||
|
||||
- Version `hardened_malloc-12-2.el9_2.security.x86_64`
|
||||
- Version `hardened_malloc-12-3.el9_2.security`
|
||||
- Based on upstream version `12`
|
||||
- No plans to support older Rocky Linux versions due to glibc being too old
|
||||
|
||||
@ -14,13 +14,17 @@ This package ships the "normal" and "light" configurations of the [GrapheneOS](h
|
||||
|
||||
It is strongly reccomended to read all documentation here before deploying this package on your infrastructure.
|
||||
|
||||
In order to support the large amount of mappings caused by guard slabs and large allocation guard guard regions, the `vm.max_map_count` sysctl is increased as part of package installation to `1048576` in `/etc/sysctl.d/hardened_malloc.conf`. The package ships 2 builds of hardened_malloc, the regular variant, which is located at `/usr/lib64/libhardened_malloc.so` and can be preloaded using the `hardened_malloc_preload.sh` script, and the light variant, which is located at `/usr/lib64/libhardened_malloc-light.so` and can be preloaded using the `hardened_malloc_light_preload.sh` script. The preload scripts adds the relevant library to `LD_PRELOAD` and then loads the desired binary, as shown in the following example: `hardened_malloc_preload.sh uname`. Users may choose to set an OS-wide `LD_PRELOAD` with hardened_malloc. This can be done by adding the desired library, for example, `/usr/lib64/libhardened_malloc.so`, into your `/etc/ld.so.preload`. Be aware that applications where `AT_SECURE` is set, this approach will not work.
|
||||
In order to support the large amount of mappings caused by guard slabs and large allocation guard regions, the `vm.max_map_count` sysctl is increased as part of package installation to `1048576` in `/etc/sysctl.d/hardened_malloc.conf`. You'll need to run `sysctl -p /etc/sysctl.d/hardened_malloc.conf` for this change to take effect without a reboot. Incidentally, [Fedora 39 made the same change](https://fedoraproject.org/wiki/Changes/IncreaseVmMaxMapCount), so it's not an exotic configuration.
|
||||
|
||||
It is suggested that if you wish to deploy hardened_malloc systemwide, that you deploy it in your `LD_PRELOAD` with the normal variant globally, and then for applications which are peformance sensitive, or which do not work, try them individually with the light variant using the preload script or by setting `LD_PRELOAD` within a systemd service namespace, and then if that does not resolve your issue, disabling it by running the program in it's own systemd service namespace.
|
||||
The package ships 2 builds of `hardened_malloc`, the regular variant, which is located at `/usr/lib64/libhardened_malloc.so` and can be preloaded using the `hardened_malloc_preload.sh` script, and the light variant, which is located at `/usr/lib64/libhardened_malloc-light.so` and can be preloaded using the `hardened_malloc_light_preload.sh` script. The preload scripts add the relevant library to `LD_PRELOAD` and then load the desired binary, as shown in the following example: `hardened_malloc_preload.sh cat /proc/self/maps`.
|
||||
|
||||
Users may choose to set an OS-wide `LD_PRELOAD` with `hardened_malloc`. This can be done by adding the desired library, for example, `/usr/lib64/libhardened_malloc.so`, into your `/etc/ld.so.preload`. Be aware that for applications where `AT_SECURE` is set, this approach will not work.
|
||||
|
||||
It is suggested that if you wish to deploy `hardened_malloc` systemwide, that you deploy it in your `LD_PRELOAD` with the normal variant globally, and then for applications which are performance sensitive, or which fail with the normal variant, try them individually with the light variant using the preload script or by setting `LD_PRELOAD` within a systemd service namespace. If that does not resolve your issue, try disabling `hardened_malloc` by running the program in its own systemd service namespace.
|
||||
|
||||
### Bugs uncovered by hardened_malloc
|
||||
|
||||
As with all infrastructure changes, ensure you test in your staging environment extensively before deploying into production. Many packages and projects suffer from memory corruption bugs, which hardened_malloc uncovers, which when running under glibc, are not encountered during operation. Some applications may crash during usage, completely break, or break when running with certain configurations. Bugs in packages are typically the result of upstream project bugs, and should be reported there. In some cases these bugs are fixed in later versions in the upstream project, in which case the bug is an issue with Rocky Linux, and should be reported to Rocky Linux, so that the patch may be included.
|
||||
As with all infrastructure changes, ensure you test in your staging environment extensively before deploying into production. Many packages and projects suffer from memory corruption bugs, which when running under glibc are not encountered during operation, but which `hardened_malloc` uncovers. Some applications may crash during usage, completely break, or break when running with certain configurations. Bugs in packages are typically a result of upstream project bugs, and should be reported there. In some cases these bugs are fixed in later versions in the upstream project, in which case the bug is an issue with Rocky Linux, and should be reported to Rocky Linux and its upstream distribution, so that the patch may be included.
|
||||
|
||||
| Package name | Latest version tested | Normal variant | Light variant |
|
||||
|-----------------|---------------------------------------------------|----------------|---------------|
|
||||
@ -30,11 +34,15 @@ As with all infrastructure changes, ensure you test in your staging environment
|
||||
|
||||
### Potential for issues with EDR
|
||||
|
||||
By nature of relying on `LD_PRELOAD`, if you have EDR software on your server, it may falsely send alerts when using hardened_malloc. If it doesn't, your EDR is probably terrible or misconfigured.
|
||||
By nature of relying on `LD_PRELOAD`, if you have EDR software on your server, it may falsely send alerts when using `hardened_malloc`. If it doesn't, your EDR is probably terrible or misconfigured.
|
||||
|
||||
### Change log
|
||||
|
||||
```
|
||||
* Tue Nov 14 2023 Solar Designer <solar@openwall.com> 12-3
|
||||
- Package hardened_malloc_light_preload.sh
|
||||
- Disable arm64 building for now (fix didn't work)
|
||||
|
||||
* Wed Nov 8 2023 flawedworld <flawedworld@flawed.world> 12-2
|
||||
- Set CONFIG_NATIVE to false
|
||||
- Mark libraries as executable (change to 755 permissions)
|
||||
|
Loading…
Reference in New Issue
Block a user