Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2282352yba; Thu, 25 Apr 2019 13:45:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqynz7HJ0Ef5mdytWWifJFDaP8zt2+uwC8RGHsMqnS1T2jhbHeTyV4cdQI6k20hJ3sMLJ6US X-Received: by 2002:a17:902:c1:: with SMTP id a59mr40310729pla.176.1556225126549; Thu, 25 Apr 2019 13:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556225126; cv=none; d=google.com; s=arc-20160816; b=JvOo2x5ftKHwknTeBovgL9YFAb18wohgs4ydU8oO4hnK66AvYiPhr5i71npJDdVflh YkEL2+W9byL9Jz8+U7kuilzOBfomSSy6RzzadJRdaTHKbnZ7QlAdWQ/lfQmlSPGkR/i5 3e2+966OmM60bQvkBlq3smIO5Jb1307+vEy/DEgthSRAzf9NUPO5S7irdMiSIpDtMI8y HvdLom2sQmY7DdE7JuFu+VLd0Vm7vXjPVp8I+0fIYNO/ZchAaSCuZZESFJ9g0dTnjnPB 99Hm+FiMsxExm0PJf6vk9l2n2tGbOX5kJPk2dPj+7kqb3TfoooTvAYA8iDvqvMhssEwJ 7v9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9T6Hh/gfaAIMuibwKFS2lWem2Wt7fkhHXq9vbgpXfiI=; b=qYJcWOgDN0eobsBgO43X9xR7SZqjlCeSqBjghijMtVL6dkD3m2n3rcHmyLQwAILeX7 2QpDNg1rd97CtfUy/hn0yBlyW350YOC4SFf54AiZ9CyVyMzC3tmweSsAb8gHjhz8yFxD 1WPUv8VfM3B6CK6dkjk/fn2xQlvsj8ztDvVkRKW2U7oxIS4Gj6ZQMh2gWuHyyWMk80jq 81UhFnbs8LawJ0vUFAs118K95h8QM5Rs4d4SIboaw4VFzmL9ZlDLBEC8slkjcFXMf/B9 wDtrHv3MqjJb3YtlhmSgzE6/bkofAWaJEOjk6X1ziwpp46Ue4+cYOHuyHcZ7dNnQClPG VvUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=X2Y0UXdY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6si15572171pgf.221.2019.04.25.13.45.10; Thu, 25 Apr 2019 13:45:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=X2Y0UXdY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387889AbfDYUoJ (ORCPT + 99 others); Thu, 25 Apr 2019 16:44:09 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:53812 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387863AbfDYUoJ (ORCPT ); Thu, 25 Apr 2019 16:44:09 -0400 Received: by mail-it1-f194.google.com with SMTP id z4so2359116itc.3 for ; Thu, 25 Apr 2019 13:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9T6Hh/gfaAIMuibwKFS2lWem2Wt7fkhHXq9vbgpXfiI=; b=X2Y0UXdYtsf1r8qUOurjsJI9eewtbXZBIc9FX3ykI64j+N6JDnvmPQgxohph6tOAzh 7oT8+8CwhPf9xiD3Jz16lMZwg6HYfEE8hmUoI3+5Q24DAvTT3LMS318fjKrafBTKMLdp /QCm5H30eeFrFQyoJqAQU6mLKhoOiFOFRKOys6WzC7PITt6PGmRIb68eV+Q9vbOIF8Lp dqqIBIsuqZsLmIJYgH7ifXN/C6bkykkP+VnH630efhebTaBgEkxtI5L/ops1ha0ExfBP J1iXAkZ/9AP474L4907G3yTct2zTI6Gj5ZWvtNVMWWSZmkuBm4Tepf10tdXxOFJ9VNkb ZKGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9T6Hh/gfaAIMuibwKFS2lWem2Wt7fkhHXq9vbgpXfiI=; b=f+lbsuBANOFDdkn45IwRwFmUymw+P3hnzdHN2ddvJVqrR2QgJiK1tKDfQ5nUX91j+U dBX1pQiR5bddHKrCnF7PgnQt4FmO9F7f4+/wkRgtrqX7K3AjzY96kWY9R1URJRzXmOuU gbytJTa6sRXhJ3TEqOti0DZFAS6yJHcoOLl/2QTZdfk9BrqnZHcvsnvwBOWNBdWu6mWg tm4mxI0cmhw/6LIZepwC5DLAHNtFL6FpJJXssl/rD2Qa19yxwOh5uLQ4stHZDCZ0cfEY +v/bmLbfjdONJk/GVJJ5RcFdn7xduFJyCTv2hPsXZ78DSM2PTBYBJDv0UItA0fZjiIXz lRNw== X-Gm-Message-State: APjAAAVtMQNL8sUXmRqWMOYE04wYdbj78zH3UgB8iLdthoZmGtzh1S9y VRYzqFPrDf8Jdvb0ZZ5D7OxwEkHQvPeIl+4cokHydg== X-Received: by 2002:a24:eb04:: with SMTP id h4mr3421463itj.16.1556225048269; Thu, 25 Apr 2019 13:44:08 -0700 (PDT) MIME-Version: 1.0 References: <20190424211038.204001-1-matthewgarrett@google.com> <20190425121410.GC1144@dhcp22.suse.cz> In-Reply-To: From: Matthew Garrett Date: Thu, 25 Apr 2019 13:43:57 -0700 Message-ID: Subject: Re: [PATCH V2] mm: Allow userland to request that the kernel clear memory on release To: Jann Horn Cc: Michal Hocko , Linux-MM , kernel list , Linux API Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 25, 2019 at 5:43 AM Jann Horn 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!