Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/imagination: Disallow exporting of PM/FW protected objects

These objects are meant to be used by the GPU firmware or by the PM unit
within the GPU, in which case they may contain physical addresses.

This adds a layer of protection against exposing potentially exploitable
information outside of the driver.

Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20251208-no-export-pm-fw-obj-v1-1-83ab12c61693@imgtec.com
Signed-off-by: Matt Coster <matt.coster@imgtec.com>

authored by

Alessio Belle and committed by
Matt Coster
6b991ad8 2bfca4fe

+11
+11
drivers/gpu/drm/imagination/pvr_gem.c
··· 28 28 drm_gem_shmem_object_free(obj); 29 29 } 30 30 31 + static struct dma_buf *pvr_gem_export(struct drm_gem_object *obj, int flags) 32 + { 33 + struct pvr_gem_object *pvr_obj = gem_to_pvr_gem(obj); 34 + 35 + if (pvr_obj->flags & DRM_PVR_BO_PM_FW_PROTECT) 36 + return ERR_PTR(-EPERM); 37 + 38 + return drm_gem_prime_export(obj, flags); 39 + } 40 + 31 41 static int pvr_gem_mmap(struct drm_gem_object *gem_obj, struct vm_area_struct *vma) 32 42 { 33 43 struct pvr_gem_object *pvr_obj = gem_to_pvr_gem(gem_obj); ··· 52 42 static const struct drm_gem_object_funcs pvr_gem_object_funcs = { 53 43 .free = pvr_gem_object_free, 54 44 .print_info = drm_gem_shmem_object_print_info, 45 + .export = pvr_gem_export, 55 46 .pin = drm_gem_shmem_object_pin, 56 47 .unpin = drm_gem_shmem_object_unpin, 57 48 .get_sg_table = drm_gem_shmem_object_get_sg_table,