All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christopher Lameter <cl@linux.com>
To: Alexander Potapenko <glider@google.com>
Cc: akpm@linux-foundation.org, linux-security-module@vger.kernel.org,
	linux-mm@kvack.org, ndesaulniers@google.com, kcc@google.com,
	dvyukov@google.com, Kees Cook <keescook@chromium.org>,
	sspatil@android.com, labbott@redhat.com,
	kernel-hardening@lists.openwall.com
Subject: Re: [PATCH] mm: security: introduce CONFIG_INIT_HEAP_ALL
Date: Tue, 16 Apr 2019 15:32:21 +0000	[thread overview]
Message-ID: <0100016a26c711be-b99971ca-49f5-482c-9028-962ee471f733-000000@email.amazonses.com> (raw)
In-Reply-To: <20190412124501.132678-1-glider@google.com>

On Fri, 12 Apr 2019, Alexander Potapenko wrote:

> diff --git a/mm/slab.h b/mm/slab.h
> index 43ac818b8592..4bb10af0031b 100644
> --- a/mm/slab.h
> +++ b/mm/slab.h
> @@ -167,6 +167,16 @@ static inline slab_flags_t kmem_cache_flags(unsigned int object_size,
>  			      SLAB_TEMPORARY | \
>  			      SLAB_ACCOUNT)
>
> +/*
> + * Do we need to initialize this allocation?
> + * Always true for __GFP_ZERO, CONFIG_INIT_HEAP_ALL enforces initialization
> + * of caches without constructors and RCU.
> + */
> +#define SLAB_WANT_INIT(cache, gfp_flags) \
> +	((GFP_INIT_ALWAYS_ON && !(cache)->ctor && \
> +	  !((cache)->flags & SLAB_TYPESAFE_BY_RCU)) || \
> +	 (gfp_flags & __GFP_ZERO))

This is another complex thing to maintain when adding flags to the slab
allocator.

> +config INIT_HEAP_ALL
> +	bool "Initialize kernel heap allocations"

"Zero pages and objects allocated in the kernel"

> +	default n
> +	help
> +	  Enforce initialization of pages allocated from page allocator
> +	  and objects returned by kmalloc and friends.
> +	  Allocated memory is initialized with zeroes, preventing possible
> +	  information leaks and making the control-flow bugs that depend
> +	  on uninitialized values more deterministic.

Hmmm... But we already have debugging options that poison objects and
pages?

  parent reply	other threads:[~2019-04-16 15:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 12:45 [PATCH] mm: security: introduce CONFIG_INIT_HEAP_ALL Alexander Potapenko
2019-04-12 12:45 ` Alexander Potapenko
2019-04-12 14:16 ` Qian Cai
2019-04-12 14:16   ` Qian Cai
2019-04-12 15:23   ` Alexander Potapenko
2019-04-12 15:23     ` Alexander Potapenko
2019-04-16  2:02 ` Andrew Morton
2019-04-16  8:33   ` Vlastimil Babka
2019-04-16 12:21   ` Alexander Potapenko
2019-04-16 12:21     ` Alexander Potapenko
2019-04-16  8:30 ` Vlastimil Babka
2019-04-16 12:04   ` Alexander Potapenko
2019-04-16 12:04     ` Alexander Potapenko
2019-04-16 15:32 ` Christopher Lameter [this message]
2019-04-16 15:32   ` Christopher Lameter
2019-04-16 16:01   ` Alexander Potapenko
2019-04-16 16:01     ` Alexander Potapenko
2019-04-16 16:30     ` Christopher Lameter
2019-04-16 16:30       ` Christopher Lameter
2019-04-17 11:03       ` Alexander Potapenko
2019-04-17 11:03         ` Alexander Potapenko
2019-04-17 17:04         ` Alexander Potapenko
2019-04-17 17:04           ` Alexander Potapenko

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=0100016a26c711be-b99971ca-49f5-482c-9028-962ee471f733-000000@email.amazonses.com \
    --to=cl@linux.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kcc@google.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sspatil@android.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.