]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
drm/i915: Prevent writing into a read-only object via a GGTT mmap
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 12 Jul 2018 18:53:13 +0000 (19:53 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 6 Nov 2019 09:20:14 +0000 (10:20 +0100)
commitc89d570f534a80c1322af3c89d358c0a99e6e37f
treed7bbeea948aee01272b3b6c513052bc94115a116
parent6a9b9dedb0f397fcb5157759e1e863ea67d6ba3f
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 <chris@chris-wilson.co.uk>
Cc: Jon Bloomfield <jon.bloomfield@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Cc: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com> #v1
Reviewed-by: Jon Bloomfield <jon.bloomfield@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180712185315.3288-4-chris@chris-wilson.co.uk
CVE-2019-0155

(backported from commit 3e977ac6179b39faa3c0eda5fce4f00663ae298d)
[tyhicks: Drop selftest changes]
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_object.h
drivers/gpu/drm/i915/intel_ringbuffer.c
include/drm/drm_vma_manager.h