OSDN Git Service

drm/i915: Implement vm_ops->access for gdb access into mmaps
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 May 2020 14:51:20 +0000 (15:51 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 May 2020 16:30:47 +0000 (17:30 +0100)
commit9f909e215fea0652023b9ed09d3d7bfe10386423
tree34df8bc60968127a3d894ed80d82de1e1b1450d7
parenta211da9c771bf97395a3ced83a3aa383372b13a7
drm/i915: Implement vm_ops->access for gdb access into mmaps

gdb uses ptrace() to peek and poke bytes of the target's address space.
The driver must implement an vm_ops->access() handler or else gdb will
be unable to inspect the pointer and report it as out-of-bounds.
Worse than useless as it causes immediate suspicion of the valid GTT
pointer, distracting the poor programmer trying to find his bug.

v2: Write-protect readonly objects (Matthew).

Testcase: igt/gem_mmap_gtt/ptrace
Testcase: igt/gem_mmap_offset/ptrace
Suggested-by: Kristian H. Kristensen <hoegsberg@google.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Maciej Patelczyk <maciej.patelczyk@intel.com>
Cc: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200501145120.18830-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_mman.c
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c