mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: list of security features in musl
Date: Thu, 11 Feb 2016 03:41:05 -0500	[thread overview]
Message-ID: <20160211084105.GL9349@brightrain.aerifal.cx> (raw)
In-Reply-To: <20160211085613.2e58f751@ncopa-desktop.alpinelinux.org>

On Thu, Feb 11, 2016 at 08:56:13AM +0100, Natanael Copa wrote:
> Hi,
> 
> Once in a while I get question about what security features there are
> in musl. Are there such list some where?

Some are briefly mentioned in the libc comparison:

http://www.etalabs.net/compare_libcs.html

but it's not very complete in this area. The things I would really
call security _features_ in musl are:

- Stack protector, with failure handling that rapidly terminates the
  process rather than continuing along error-reporting code paths
  which can themselves provide an attack surface.

- Double-free protection (to the extent possible), with the same rapid
  termination.

- Moderate level heap overflow protection - checking for clobbered
  heap chunk footers on realloc and free, also with rapid termination.

- Ability to build libc itself with stack protector enabled, to catch
  libc-internal stack smashing.

- Password hashing with bcrypt.

- Ability to use PIE together with static linking (load static-linked
  program at randomized address).

- Blocking all LD_* for suid/sgid binaries, not just partially
  restricting what they can do.

- Translatable text in libc is purely literal strings, no format
  strings, so buggy or malicious translations are not a format string
  attack vector.

In addition, the following design concepts/practices contribute to
security:

- Simplicity/reviewability of code ("The main security feature is that
  you can read the code" - nsz).

- Non-use of arbitrary-size VLA/alloca, minimal dynamic allocation.

- Attention to subtle race condition and async-signal safety issues,
  as demonstrated by the extensive list of such bugs found in glibc by
  musl developers.

- Aim to avoid/remove all undefined behavior even when it's not yet
  dangerous with current compiler technology.

- Safe, fully-standards-conforming handling of UTF-8.

- Producing consistent results even under transient errors (failure to
  obtain a file/resource does not cause silent fallback to defaults
  that may be wrong).

- No late/lazy allocation that would require aborting the program if
  it fails.

There are probably more interesting points for security, but I think I
covered the most important ones. If I missed any, reply with
additions.

Rich


  reply	other threads:[~2016-02-11  8:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11  7:56 Natanael Copa
2016-02-11  8:41 ` Rich Felker [this message]
2016-02-11 19:11   ` Szabolcs Nagy
2016-02-16 17:45     ` Solar Designer
2016-02-16 19:44       ` Szabolcs Nagy
2016-02-16 20:39         ` Rich Felker
2016-02-16 20:44           ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160211084105.GL9349@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).