Skip to contentSkip to conversation

Linux kernel: drivers/gpu/drm/i915/i915_gem.c: i915_gem_pread_ioctl similar Double-Fetch bug

DISCUSSION sohu0106 2 participants 3 messages Dec 16, 2017 – Dec 18, 2017

lore
Share & tools
lore

sohu0106

author
#0 lore raw

Hi,

I found a similar Double-Fetch bug in drivers/gpu/drm/i915/i915_gem.c when I was examining the source code.

In function i915_gem_pread_ioctl(), the driver check user space data by pointer data_ptr via access_ok() in line 694, and after run a while, in function shmem_pread_slow in line 657 or shmem_pread_fast in line 639, finally it use __copy_to_user with no check user space pointer.

If the args->data_ptr is modified by a user thread under race condition between the check and __copy_to_user operations, for example changing to a kernel address, this will lead to Arbitrary kernel address writing(caused by __copy_to_user() ).

I am looking forward to a reply on this, thank you!

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw
Quoted 2 lines · On Sat, 16 Dec 2017, sohu0106 <[email protected]> wrote:

I found a similar Double-Fetch bug in drivers/gpu/drm/i915/i915_gem.c when I was examining the source code.

Similar to what?

Quoted 10 lines

In function i915_gem_pread_ioctl(), the driver check user space data by pointer data_ptr via access_ok() in line 694, and after run a while, in function shmem_pread_slow in line 657 or shmem_pread_fast in line 639, finally it use __copy_to_user with no check user space pointer.

If the args->data_ptr is modified by a user thread under race condition between the check and __copy_to_user operations, for example changing to a kernel address, this will lead to Arbitrary kernel address writing(caused by __copy_to_user() ).

See drm_ioctl() for why this is not a possible scenario.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx