[PATCH v22 1/5] drm/xe/xe_gt_pagefault: Disallow writes to read-only VMAs
Matthew Brost
matthew.brost at intel.com
Thu Apr 24 19:36:38 UTC 2025
On Thu, Apr 24, 2025 at 02:38:06PM +0000, Jonathan Cavitt wrote:
> The page fault handler should reject write/atomic access to read only
> VMAs. Add code to handle this in handle_pagefault after the VMA lookup.
>
> Fixes: 3d420e9fa848 ("drm/xe: Rework GPU page fault handling")
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
> Suggested-by: Matthew Brost <matthew.brost at intel.com>
Reviewed-by: Matthew Brost <matthew.brost at intel.com>
> Reviewed-by: Shuicheng Lin <shuicheng.lin at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_pagefault.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> index 10622ca471a2..d4e3b7eb165a 100644
> --- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> @@ -237,6 +237,11 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
> goto unlock_vm;
> }
>
> + if (xe_vma_read_only(vma) && pf->access_type != ACCESS_TYPE_READ) {
> + err = -EPERM;
> + goto unlock_vm;
> + }
> +
> atomic = access_is_atomic(pf->access_type);
>
> if (xe_vma_is_cpu_addr_mirror(vma))
> --
> 2.43.0
>
More information about the Intel-xe
mailing list