OpenBSD Journal

malloc.conf replaced with a sysctl

Contributed by Janne Johansson on from the can-we-softctl-or-syslink-it dept.

In this commit, Otto Moerbeek (otto@) moved malloc handling from a softlink in /etc to a sysctl instead.
Otto@ writes:

We are moving away from the /etc/malloc.conf symbolic link to a new sysctl:

        $ sysctl vm.malloc_conf       

This will allow unveiled and chrooted processes to access the malloc options without having to do anything special in the code or chroot dir.

He continued the heads up with:

As I often get this question: for some extra protection, use C or CF, accept some performance impact.
For development, bug hunting and/or extra security use S, with more performance impact.

Note that with default options, malloc already has quite some protection features.

Upcoming snapshots will contain this.
The other two ways to change malloc(3) behaviour are still left, either setting the environment variable MALLOC_OPTIONS before starting the program or adding a static string named "malloc_options" in your source code.

(Comments are closed)

  1. By Renaud Allard (renaud) on

    Good idea. In fact, one has to wonder why this hasn't been done before as this is quite clearer than the malloc.conf symlink where many people didn't understand how to configure (although clearly documented).


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]