From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH v6 1/5] vfs: add flags parameter to ->mmap() in 'struct file_operations' Date: Thu, 24 Aug 2017 09:58:38 -0700 Message-ID: <20170824165838.GB3121@infradead.org> References: <150353211413.5039.5228914877418362329.stgit@dwillia2-desk3.amr.corp.intel.com> <150353211985.5039.4333061601382775843.stgit@dwillia2-desk3.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <150353211985.5039.4333061601382775843.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org Sender: "Linux-nvdimm" To: Dan Williams Cc: Jan Kara , linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org, David Airlie , linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Takashi Iwai , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Julia Lawall , luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Daniel Vetter , akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org List-Id: linux-api@vger.kernel.org On Wed, Aug 23, 2017 at 04:48:40PM -0700, Dan Williams wrote: > We are running running short of vma->vm_flags. We can avoid needing a > new VM_* flag in some cases if the original @flags submitted to mmap(2) > is made available to the ->mmap() 'struct file_operations' > implementation. For example, the proposed addition of MAP_DIRECT can be > implemented without taking up a new vm_flags bit. Another motivation to > avoid vm_flags is that they appear in /proc/$pid/smaps, and we have seen > software that tries to dangerously (TOCTOU) read smaps to infer the > behavior of a virtual address range. > > This conversion was performed by the following semantic patch. There > were a few manual edits for oddities like proc_reg_mmap. > > Thanks to Julia for helping me with coccinelle iteration to cover cases > where the mmap routine is defined in a separate file from the 'struct > file_operations' instance that consumes it. How are we going to check that an instance actually supports any of those flags?