linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: "David Herrmann" <dh.herrmann@gmail.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: linux-mm <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	aarcange@redhat.com, Hugh Dickins <hughd@google.com>,
	nyc@holomorphy.com
Subject: Re: [PATCH 4/6] hugetlbfs: implement memfd sealing
Date: Fri, 3 Nov 2017 10:12:59 -0700	[thread overview]
Message-ID: <ca908533-2905-e28a-db3a-c3cf9c98bbed@oracle.com> (raw)
In-Reply-To: <CANq1E4SC8Hi4h9hxUM70+qOL4K95cXuMF9DKGw4dGhfmktrqsA@mail.gmail.com>

On 11/03/2017 10:03 AM, David Herrmann wrote:
> Hi
> 
> On Tue, Oct 31, 2017 at 7:40 PM, Marc-André Lureau
> <marcandre.lureau@redhat.com> wrote:
>> Implements memfd sealing, similar to shmem:
>> - WRITE: deny fallocate(PUNCH_HOLE). mmap() write is denied in
>>   memfd_add_seals(). write() doesn't exist for hugetlbfs.
>> - SHRINK: added similar check as shmem_setattr()
>> - GROW: added similar check as shmem_setattr() & shmem_fallocate()
>>
>> Except write() operation that doesn't exist with hugetlbfs, that
>> should make sealing as close as it can be to shmem support.
> 
> SEAL, SHRINK, and GROW look fine to me.
> 
> Regarding WRITE

The commit message may not be clear.  However, hugetlbfs does not support
the write system call (or aio).  The only way to modify contents of a
hugetlbfs file is via mmap or hole punch/truncate.  So, we do not really
need to worry about those special (a)io cases for hugetlbfs.

-- 
Mike Kravetz

>                 you need to make sure there are no page references
> left around. For instance, on shmem any process might trigger the
> kernel to GUP mapped shmem pages for asynchronous IO, then unmap the
> file and request F_SEAL_WRITE. In this case the seal must be rejected
> *iff* the pages are still pinned. shmem does this by requiring the
> page-refcounts to be 0. Preferably there would be some better
> infrastructure that tells us whether someone operates on those pages,
> but this does not exist right now. See shmem_wait_for_pins() for
> details.
> 
> I have little knowledge on how hugetlbs integrate with the page-cache
> and radix-tree, hence I'd prefer if someone can explicitly ACK that
> shmem_wait_for_pins() is suitable for hugetlbfs.
> 
> Otherwise, this series looks good to me (minus the #ifdef mess..).
> 
> Thanks
> David
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=ilto:"dont@kvack.org"> email@kvack.org </a>
> 

  reply	other threads:[~2017-11-03 17:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 18:40 [PATCH 0/6] memfd: add sealing to hugetlb-backed memory Marc-André Lureau
2017-10-31 18:40 ` [PATCH 1/6] shmem: unexport shmem_add_seals()/shmem_get_seals() Marc-André Lureau
2017-11-01 22:50   ` Mike Kravetz
2017-10-31 18:40 ` [PATCH 2/6] shmem: rename functions that are memfd-related Marc-André Lureau
2017-11-01 23:01   ` Mike Kravetz
2017-11-03 16:02     ` Marc-André Lureau
2017-11-03 16:22       ` Mike Kravetz
2017-11-03 16:36         ` Marc-André Lureau
2017-11-03 18:07           ` Mike Kravetz
2017-10-31 18:40 ` [PATCH 3/6] hugetlb: expose hugetlbfs_inode_info in header Marc-André Lureau
2017-11-01 23:20   ` Mike Kravetz
2017-11-03 16:14     ` Marc-André Lureau
2017-11-03 16:23       ` Mike Kravetz
2017-10-31 18:40 ` [PATCH 4/6] hugetlbfs: implement memfd sealing Marc-André Lureau
2017-11-01 23:44   ` Mike Kravetz
2017-11-03 17:03   ` David Herrmann
2017-11-03 17:12     ` Mike Kravetz [this message]
2017-11-03 17:41       ` David Herrmann
2017-11-03 17:56         ` Mike Kravetz
2017-11-03 23:31           ` Mike Kravetz
2017-11-05 12:07             ` David Herrmann
2017-10-31 18:40 ` [PATCH 5/6] shmem: add sealing support to hugetlb-backed memfd Marc-André Lureau
2017-11-02  0:18   ` Mike Kravetz
2017-11-03 16:13     ` Marc-André Lureau
2017-10-31 18:40 ` [PATCH 6/6] memfd-tests: test hugetlbfs sealing Marc-André Lureau
2017-11-03 23:59   ` Mike Kravetz

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=ca908533-2905-e28a-db3a-c3cf9c98bbed@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=dh.herrmann@gmail.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=nyc@holomorphy.com \
    /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).