[PATCH v2 15/17] sysfs: Support zapping of binary attr mmaps

Greg Kroah-Hartman gregkh at linuxfoundation.org
Fri Oct 9 10:58:03 UTC 2020


On Fri, Oct 09, 2020 at 09:59:32AM +0200, Daniel Vetter wrote:
> We want to be able to revoke pci mmaps so that the same access rules
> applies as for /dev/kmem. Revoke support for devmem was added in
> 3234ac664a87 ("/dev/mem: Revoke mappings when a driver claims the
> region").
> 
> The simplest way to achieve this is by having the same filp->f_mapping
> for all mappings, so that unmap_mapping_range can find them all, no
> matter through which file they've been created. Since this must be set
> at open time we need sysfs support for this.
> 
> Add an optional mapping parameter bin_attr, which is only consulted
> when there's also an mmap callback, since without mmap support
> allowing to adjust the ->f_mapping makes no sense.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> Cc: Jason Gunthorpe <jgg at ziepe.ca>
> Cc: Kees Cook <keescook at chromium.org>
> Cc: Dan Williams <dan.j.williams at intel.com>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: John Hubbard <jhubbard at nvidia.com>
> Cc: Jérôme Glisse <jglisse at redhat.com>
> Cc: Jan Kara <jack at suse.cz>
> Cc: Dan Williams <dan.j.williams at intel.com>
> Cc: linux-mm at kvack.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-samsung-soc at vger.kernel.org
> Cc: linux-media at vger.kernel.org
> Cc: Bjorn Helgaas <bhelgaas at google.com>
> Cc: linux-pci at vger.kernel.org
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael at kernel.org>
> Cc: Christian Brauner <christian.brauner at ubuntu.com>
> Cc: "David S. Miller" <davem at davemloft.net>
> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Cc: Sourabh Jain <sourabhjain at linux.ibm.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Mauro Carvalho Chehab <mchehab+huawei at kernel.org>
> Cc: Nayna Jain <nayna at linux.ibm.com>
> ---
>  fs/sysfs/file.c       | 11 +++++++++++
>  include/linux/sysfs.h |  2 ++
>  2 files changed, 13 insertions(+)

Reviewed-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>


More information about the dri-devel mailing list