[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANq1E4SC8Hi4h9hxUM70+qOL4K95cXuMF9DKGw4dGhfmktrqsA@mail.gmail.com>
Date: Fri, 3 Nov 2017 18:03:54 +0100
From: David Herrmann <dh.herrmann@...il.com>
To: Marc-André Lureau <marcandre.lureau@...hat.com>
Cc: linux-mm <linux-mm@...ck.org>,
linux-kernel <linux-kernel@...r.kernel.org>, aarcange@...hat.com,
Hugh Dickins <hughd@...gle.com>, nyc@...omorphy.com,
mike.kravetz@...cle.com
Subject: Re: [PATCH 4/6] hugetlbfs: implement memfd sealing
Hi
On Tue, Oct 31, 2017 at 7:40 PM, Marc-André Lureau
<marcandre.lureau@...hat.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 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
Powered by blists - more mailing lists