linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Garrett <mjg59@google.com>
To: Jann Horn <jannh@google.com>
Cc: Michal Hocko <mhocko@kernel.org>, Linux-MM <linux-mm@kvack.org>,
	kernel list <linux-kernel@vger.kernel.org>,
	Linux API <linux-api@vger.kernel.org>
Subject: Re: [PATCH V2] mm: Allow userland to request that the kernel clear memory on release
Date: Thu, 25 Apr 2019 13:43:57 -0700	[thread overview]
Message-ID: <CACdnJuu__NS3Py+heKPDdTJSe53Wr9AP-oArO7mVRky2wqMp2g@mail.gmail.com> (raw)
In-Reply-To: <CAG48ez0x6QiFpqXbimB9ZV-jS5UJJWhzg9XiAWncQL+phfKkPA@mail.gmail.com>

On Thu, Apr 25, 2019 at 5:43 AM Jann Horn <jannh@google.com> wrote:
> An interesting effect of this is that it will be possible to set this
> on a CoW anon VMA in a fork() child, and then the semantics in the
> parent will be subtly different - e.g. if the parent vmsplice()d a
> CoWed page into a pipe, then forked an unprivileged child, the child
> set MADV_WIPEONRELEASE on its VMA, the parent died somehow, and then
> the child died, the page in the pipe would be zeroed out. A child
> should not be able to affect its parent like this, I think. If this
> was an mmap() flag instead of a madvise() command, that issue could be
> avoided. Alternatively, if adding more mmap() flags doesn't work,
> perhaps you could scan the VMA and ensure that it contains no pages
> yet, or something like that?

I /think/ my argument here would be not to do that? I agree that it's
unexpected, but I guess the other alternative would be to force a copy
on any existing COW pages in the VMA at madvise() time, and maybe also
at fork() time (sort of like the behaviour of MADV_WIPEONFORK, but
copying the page rather than providing a new zero page)

> I think all the callers have a reference to the VMA, so perhaps you
> could add a VMA parameter to page_remove_rmap() and then look at the
> VMA in there?

I'll dig into that, thanks!

  reply	other threads:[~2019-04-25 20:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CACdnJuup-y1xAO93wr+nr6ARacxJ9YXgaceQK9TLktE7shab1w@mail.gmail.com>
     [not found] ` <20190424211038.204001-1-matthewgarrett@google.com>
2019-04-25 12:14   ` [PATCH V2] mm: Allow userland to request that the kernel clear memory on release 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 [this message]
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

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=CACdnJuu__NS3Py+heKPDdTJSe53Wr9AP-oArO7mVRky2wqMp2g@mail.gmail.com \
    --to=mjg59@google.com \
    --cc=jannh@google.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).