linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Garrett <mjg59@google.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: Allow userland to request that the kernel clear memory on release
Date: Wed, 24 Apr 2019 12:33:11 -0700	[thread overview]
Message-ID: <CACdnJutj4K1kQj7yXcCNVWM_hmrUwMfZ-JBi=FHkBvYFfbJNZA@mail.gmail.com> (raw)
In-Reply-To: <20190424192812.GG19031@bombadil.infradead.org>

On Wed, Apr 24, 2019 at 12:28 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Wed, Apr 24, 2019 at 12:14:40PM -0700, Matthew Garrett wrote:
> > Unfortunately, if an application exits uncleanly, its secrets may still be
> > present in RAM. This can't be easily fixed in userland (eg, if the OOM
> > killer decides to kill a process holding secrets, we're not going to be able
> > to avoid that), so this patch adds a new flag to madvise() to allow userland
> > to request that the kernel clear the covered pages whenever the page
> > reference count hits zero. Since vm_flags is already full on 32-bit, it
> > will only work on 64-bit systems.
>
> Your request seems reasonable to me.
>
> > +++ b/include/linux/page-flags.h
> > @@ -118,6 +118,7 @@ enum pageflags {
> >       PG_reclaim,             /* To be reclaimed asap */
> >       PG_swapbacked,          /* Page is backed by RAM/swap */
> >       PG_unevictable,         /* Page is "unevictable"  */
> > +     PG_wipeonrelease,
>
> But you can't have a new PageFlag.  Can you instead zero the memory in
> unmap_single_vma() where we call uprobe_munmap() and untrack_pfn() today?

Is there any way the page could be referenced by something other than
a VMA at this point? If so we probably don't want to zero it here, but
we do want to zero it when the page is finally released (which is why
I went with a page flag)


  reply	other threads:[~2019-04-24 19:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 19:14 Matthew Garrett
2019-04-24 19:28 ` Matthew Wilcox
2019-04-24 19:33   ` Matthew Garrett [this message]
2019-04-24 20:20     ` Matthew Wilcox
2019-04-24 20:22       ` Matthew Garrett
2019-04-24 21:10         ` [PATCH V2] " Matthew Garrett
2019-04-25 12:14           ` Michal Hocko
2019-04-25 12:37             ` Michal Hocko
2019-04-25 20:39               ` Matthew Garrett
2019-04-26  5:25                 ` Michal Hocko
2019-04-26 18:08                   ` Matthew Garrett
2019-04-29 21:44                     ` Michal Hocko
2019-04-25 12:40             ` Vlastimil Babka
2019-04-25 20:45               ` Matthew Garrett
2019-04-25 12:42             ` Jann Horn
2019-04-25 20:43               ` Matthew Garrett
2019-04-26  5:31               ` Michal Hocko
2019-04-26 13:33                 ` Jann Horn
2019-04-26 13:47                   ` Michal Hocko
2019-04-26 14:03                     ` Jann Horn
2019-04-26 14:08                       ` Michal Hocko
2019-04-25 22:58         ` [PATCH V3] " Matthew Garrett
2019-04-26  7:45           ` Vlastimil Babka
2019-04-26 18:10             ` Matthew Garrett
2019-04-29 19:36         ` [PATCH V4] " Matthew Garrett
2019-06-05 18:26           ` Matthew Garrett
2019-06-06 22:45             ` Kees Cook
2019-04-25 15:32 ` [PATCH] " Christopher Lameter
2019-04-25 20:29   ` Matthew Garrett

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='CACdnJutj4K1kQj7yXcCNVWM_hmrUwMfZ-JBi=FHkBvYFfbJNZA@mail.gmail.com' \
    --to=mjg59@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.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