drm/gem-shmem: Set vm_ops in static initializer
Subsystems (2)
Thomas Zimmermann
maintainerPATCH 1/2 drm/gem-shmem: Set vm_ops in static initializer
Initialize default vm_ops in static initialization of the GEM SHMEM funcs, instead of the mmap code. It's simply better style. GEM helpers will later set a VMA's vm_ops from the default automatically.
Signed-off-by Thomas Zimmermann <[email protected]>
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +3 -1
@@ -25,6 +25,8 @@MODULE_IMPORT_NS (DMA_BUF ); +static const struct vm_operations_struct drm_gem_shmem_vm_ops; +/** * DOC: overview *
@@ -46,6 +48,7 @@ static const struct drm_gem_object_funcs drm_gem_shmem_funcs = { .vmap = drm_gem_shmem_object_vmap, .vunmap = drm_gem_shmem_object_vunmap, .mmap = drm_gem_shmem_object_mmap, + .vm_ops = &drm_gem_shmem_vm_ops, }; static struct drm_gem_shmem_object *
@@ -625,7 +628,6 @@ int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, struct vm_area_struct vma->vm_page_prot =vm_get_page_prot (vma->vm_flags);if (shmem->map_wc) vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot); - vma->vm_ops = &drm_gem_shmem_vm_ops;return 0 ; }
Signature · 1 line
2.34.1
Thomas Zimmermann
maintainerPATCH 2/2 drm/gem-shmem: Don't store mmap'ed buffers in core dumps
Set the VM_DONTDUMP flag on mmap'ed VMAs to omit them from core dumps. It's display-buffer memory; who knows what secrets these buffers contain.
Signed-off-by Thomas Zimmermann <[email protected]>
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +1 -1
@@ -624,7 +624,7 @@ int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, struct vm_area_structreturn ret; } - vma->vm_flags |=VM_PFNMAP |VM_DONTEXPAND ; + vma->vm_flags |=VM_PFNMAP |VM_DONTEXPAND |VM_DONTDUMP ; vma->vm_page_prot =vm_get_page_prot (vma->vm_flags);if (shmem->map_wc) vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot);
Signature · 1 line
2.34.1