]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/gem-dma: set VM_DONTDUMP for mmap
authorChen-Yu Tsai <wenst@chromium.org>
Tue, 17 Mar 2026 04:00:32 +0000 (12:00 +0800)
committerChen-Yu Tsai <wenst@chromium.org>
Thu, 26 Mar 2026 06:35:18 +0000 (14:35 +0800)
When the mmap function was converted from a file op to a GEM object
function in commit f5ca8eb6f9bd ("drm/cma-helper: Implement mmap as GEM
CMA object functions") some VM flags were not lifted from drm_gem_mmap():

  - VM_IO
  - VM_DONTEXPAND
  - VM_DONTDUMP

VM_DONTEXPAND was added back in commit 59f39bfa6553 ("drm/cma-helper:
Set VM_DONTEXPAND for mmap"). VM_IO doesn't make sense since these are
memory buffers, while "IO tells people not to look at these pages
(accesses can have side effects)".

Add back VM_DONTDUMP. This matches the behavior of most other GEM
implementations.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patch.msgid.link/20260317040034.617585-1-wenst@chromium.org
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
drivers/gpu/drm/drm_gem_dma_helper.c

index 70f83e4644766b8b18e2e4e67bb18e86d728466f..1c00a71ab3c9d0b3b7537ef6168f9b521e55608b 100644 (file)
@@ -537,7 +537,7 @@ int drm_gem_dma_mmap(struct drm_gem_dma_object *dma_obj, struct vm_area_struct *
         * the whole buffer.
         */
        vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node);
-       vm_flags_mod(vma, VM_DONTEXPAND, VM_PFNMAP);
+       vm_flags_mod(vma, VM_DONTDUMP | VM_DONTEXPAND, VM_PFNMAP);
 
        if (dma_obj->map_noncoherent) {
                vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);