diff options
| author | Chris Wilson <[email protected]> | 2018-07-12 18:53:13 +0000 |
|---|---|---|
| committer | Chris Wilson <[email protected]> | 2018-07-13 15:14:04 +0000 |
| commit | 3e977ac6179b39faa3c0eda5fce4f00663ae298d (patch) | |
| tree | b281e50e673251b362eaa99b8468ff83f98c4045 /drivers/gpu/drm/i915/intel_ringbuffer.c | |
| parent | drm/i915/gtt: Disable read-only support under GVT (diff) | |
| download | kernel-3e977ac6179b39faa3c0eda5fce4f00663ae298d.tar.gz kernel-3e977ac6179b39faa3c0eda5fce4f00663ae298d.zip | |
drm/i915: Prevent writing into a read-only object via a GGTT mmap
If the user has created a read-only object, they should not be allowed
to circumvent the write protection by using a GGTT mmapping. Deny it.
Also most machines do not support read-only GGTT PTEs, so again we have
to reject attempted writes. Fortunately, this is known a priori, so we
can at least reject in the call to create the mmap (with a sanity check
in the fault handler).
v2: Check the vma->vm_flags during mmap() to allow readonly access.
v3: Remove VM_MAYWRITE to curtail mprotect()
Testcase: igt/gem_userptr_blits/readonly_mmap*
Signed-off-by: Chris Wilson <[email protected]>
Cc: Jon Bloomfield <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: Matthew Auld <[email protected]>
Cc: David Herrmann <[email protected]>
Reviewed-by: Matthew Auld <[email protected]> #v1
Reviewed-by: Jon Bloomfield <[email protected]>
Reviewed-by: Joonas Lahtinen <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 6de88add508a..69bd7f697f6d 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -1100,7 +1100,7 @@ intel_ring_create_vma(struct drm_i915_private *dev_priv, int size) * if supported by the platform's GGTT. */ if (vm->has_read_only) - obj->gt_ro = 1; + i915_gem_object_set_readonly(obj); vma = i915_vma_instance(obj, vm, NULL); if (IS_ERR(vma)) |
