public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Jefferson Carpenter <jeffersoncarpenter2@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Subject: Re: Memory zeroed when made available to user process
Date: Fri, 29 Jun 2018 08:10:45 +0200	[thread overview]
Message-ID: <8169843.ZtXGbniY5N@blindfold> (raw)
In-Reply-To: <c1cda925-72bd-5937-a73d-617fd6f50c8e@gmail.com>

Am Freitag, 29. Juni 2018, 02:52:16 CEST schrieb Jefferson Carpenter:
> On 6/27/2018 1:18 PM, Richard Weinberger wrote:
> > Am Mittwoch, 27. Juni 2018, 15:12:48 CEST schrieb Michal Hocko:
> >> On Wed 27-06-18 13:29:05, Richard Weinberger wrote:
> >>> On Wed, Jun 27, 2018 at 11:34 AM, Jefferson Carpenter
> >>> <jeffersoncarpenter2@gmail.com> wrote:
> >>>> Is there a way for a user process to mark memory as 'sensitive' or
> >>>> 'non-sensitive' when it is allocated?  That could allow it not to have to be
> >>>> zeroed before being allocated to another process.
> >>>
> >>> Isn't this what we have Meltdown and Spectre for? ;-)
> >>>
> >>> No, memory from the kernel is always zeroed.
> >>> libc offers malloc() and calloc() for this purpose.
> 
> Interesting.  Let's say
> 
> Process 1:
> free(use_memory(malloc(1024)));
> 
> Then Process 2:
> malloc(1024);
> 
> The physical RAM used to service Process 2's malloc call has to be 
> zeroed to prevent it from leaking data from Process 1.  However, if 
> Process 1 could mark that memory as non-sensitive, then it would not 
> have to be zeroed, saving the time it takes to do that.  However, this 
> would require at least a bit per memory page, so maybe it's not worth it.

Is this really a measurable overhead on your system?
Do you have numbers?

Thanks,
//richard

      reply	other threads:[~2018-06-29  6:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  9:34 Memory zeroed when made available to user process Jefferson Carpenter
2018-06-27 11:29 ` Richard Weinberger
2018-06-27 13:12   ` Michal Hocko
2018-06-27 13:18     ` Richard Weinberger
2018-06-29  0:52       ` Jefferson Carpenter
2018-06-29  6:10         ` Richard Weinberger [this message]

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=8169843.ZtXGbniY5N@blindfold \
    --to=richard@nod.at \
    --cc=jeffersoncarpenter2@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox