[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACdnJutj4K1kQj7yXcCNVWM_hmrUwMfZ-JBi=FHkBvYFfbJNZA@mail.gmail.com>
Date: Wed, 24 Apr 2019 12:33:11 -0700
From: Matthew Garrett <mjg59@...gle.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-mm@...ck.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: Allow userland to request that the kernel clear
memory on release
On Wed, Apr 24, 2019 at 12:28 PM Matthew Wilcox <willy@...radead.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)
Powered by blists - more mailing lists