From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965957AbaFQRBa (ORCPT ); Tue, 17 Jun 2014 13:01:30 -0400 Received: from mail-ve0-f175.google.com ([209.85.128.175]:64403 "EHLO mail-ve0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965003AbaFQRB0 (ORCPT ); Tue, 17 Jun 2014 13:01:26 -0400 MIME-Version: 1.0 In-Reply-To: References: <1402655819-14325-1-git-send-email-dh.herrmann@gmail.com> <53A01049.6020502@redhat.com> From: Andy Lutomirski Date: Tue, 17 Jun 2014 10:01:05 -0700 Message-ID: Subject: Re: [PATCH v3 0/7] File Sealing & memfd_create() To: David Herrmann Cc: "linux-mm@kvack.org" , Greg KH , Florian Weimer , Hugh Dickins , "linux-kernel@vger.kernel.org" , Lennart Poettering , Andrew Morton , Linux API , Michael Kerrisk , Kay Sievers , John Stultz , Linus Torvalds , Daniel Mack , Ryan Lortie , Linux FS Devel , Tony Battersby Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 17, 2014 at 9:51 AM, David Herrmann wrote: > Hi > > On Tue, Jun 17, 2014 at 6:41 PM, Andy Lutomirski wrote: >> On Tue, Jun 17, 2014 at 9:36 AM, David Herrmann wrote: >>> Hi >>> >>> On Tue, Jun 17, 2014 at 6:20 PM, Andy Lutomirski wrote: >>>> Can you summarize why holes can't be reliably backed by the zero page? >>> >>> To answer this, I will quote Hugh from "PATCH v2 1/3": >>> >>>> We do already use the ZERO_PAGE instead of allocating when it's a >>>> simple read; and on the face of it, we could extend that to mmap >>>> once the file is sealed. But I am rather afraid to do so - for >>>> many years there was an mmap /dev/zero case which did that, but >>>> it was an easily forgotten case which caught us out at least >>>> once, so I'm reluctant to reintroduce it now for sealing. >>>> >>>> Anyway, I don't expect you to resolve the issue of sealed holes: >>>> that's very much my territory, to give you support on. >>> >>> Holes can be avoided with a simple fallocate(). I don't understand why >>> I should make SEAL_WRITE do the fallocate for the caller. During the >>> discussion of memfd_create() I was told to drop the "size" parameter, >>> because it is redundant. I don't see how this implicit fallocate() >>> does not fall into the same category? >>> >> >> I'm really confused now. >> >> If I SEAL_WRITE a file, and then I mmap it PROT_READ, and then I read >> it, is that a "simple read"? If so, doesn't that mean that there's no >> problem? > > I assumed Hugh was talking about read(). So no, this is not about > memory-reads on mmap()ed regions. > > Looking at shmem_file_read_iter() I can see a ZERO_PAGE(0) call in > case shmem_getpage_gfp(SGP_READ) tells us there's a hole. I cannot see > anything like that in the mmap_region() and shmem_fault() paths. Would it be easy to fix this just for SEAL_WRITE files? Hugh? This would make the interface much nicer, IMO. --Andy > > Thanks > David -- Andy Lutomirski AMA Capital Management, LLC