android_kernel_samsung_sm8650/drivers/gpu/drm/vmwgfx
Jason Gunthorpe 0d97950953 drm/ttm: remove ttm_bo_vm_insert_huge()
The huge page functionality in TTM does not work safely because PUD and
PMD entries do not have a special bit.

get_user_pages_fast() considers any page that passed pmd_huge() as
usable:

	if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd) ||
		     pmd_devmap(pmd))) {

And vmf_insert_pfn_pmd_prot() unconditionally sets

	entry = pmd_mkhuge(pfn_t_pmd(pfn, prot));

eg on x86 the page will be _PAGE_PRESENT | PAGE_PSE.

As such gup_huge_pmd() will try to deref a struct page:

	head = try_grab_compound_head(pmd_page(orig), refs, flags);

and thus crash.

Thomas further notices that the drivers are not expecting the struct page
to be used by anything - in particular the refcount incr above will cause
them to malfunction.

Thus everything about this is not able to fully work correctly considering
GUP_fast. Delete it entirely. It can return someday along with a proper
PMD/PUD_SPECIAL bit in the page table itself to gate GUP_fast.

Fixes: 314b6580ad ("drm/ttm, drm/vmwgfx: Support huge TTM pagefaults")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Thomas Hellström <thomas.helllstrom@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
[danvet: Update subject per Thomas' &Christian's review]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/0-v2-a44694790652+4ac-ttm_pmd_jgg@nvidia.com
2021-11-05 11:13:19 +01:00
..
device_include drm/vmwgfx: Replace "vmw_num_pages" with "PFN_UP" 2021-08-09 17:30:35 -04:00
Kconfig drm/vmwgfx: Fix build issues in mksGuestStats discovered by the kernel test robot 2021-06-16 14:43:05 -04:00
Makefile drm/vmwgfx: Simplify devcaps code 2021-06-12 00:00:48 -04:00
ttm_memory.c drm/vmwgfx: Fix some static checker warnings 2021-06-12 00:00:59 -04:00
ttm_memory.h drm/ttm: move memory accounting into vmwgfx v4 2021-02-09 17:27:33 +01:00
ttm_object.c drm/vmwgfx: replace idr_init() by idr_init_base() 2021-04-29 14:54:54 -04:00
ttm_object.h drm/ttm: move memory accounting into vmwgfx v4 2021-02-09 17:27:33 +01:00
vmw_surface_cache.h drm/vmwgfx: Update device headers 2021-06-16 14:27:00 -04:00
vmwgfx_binding.c drm/vmwgfx: Update device headers 2021-06-16 14:27:00 -04:00
vmwgfx_binding.h drm/vmwgfx: Add support for streamoutput with mob commands 2020-03-23 22:39:35 +01:00
vmwgfx_blit.c drm/ttm: rename bo->mem and make it a pointer 2021-06-02 11:07:25 +02:00
vmwgfx_bo.c drm/ttm: cleanup ttm_resource_compat 2021-09-03 11:03:59 +02:00
vmwgfx_cmd.c drm/vmwgfx: Cleanup logging 2021-07-28 14:53:23 -04:00
vmwgfx_cmdbuf_res.c drm/vmwgfx: Use list_move_tail instead of list_del/list_add_tail in vmwgfx_cmdbuf_res.c 2021-08-09 17:29:32 -04:00
vmwgfx_cmdbuf.c drm/vmwgfx: Make use of PFN_ALIGN/PFN_UP helper macro 2021-08-09 17:30:34 -04:00
vmwgfx_context.c drm/vmwgfx: Update device headers 2021-06-16 14:27:00 -04:00
vmwgfx_cotable.c drm/vmwgfx: Make use of PFN_ALIGN/PFN_UP helper macro 2021-08-09 17:30:34 -04:00
vmwgfx_devcaps.c drm/vmwgfx: Update device headers 2021-06-16 14:27:00 -04:00
vmwgfx_devcaps.h drm/vmwgfx: Update device headers 2021-06-16 14:27:00 -04:00
vmwgfx_drv.c drm/vmwgfx: Be a lot more flexible with MOB limits 2021-07-28 14:53:25 -04:00
vmwgfx_drv.h drm/ttm: remove ttm_bo_vm_insert_huge() 2021-11-05 11:13:19 +01:00
vmwgfx_execbuf.c drm/vmwgfx: Update device headers 2021-06-16 14:27:00 -04:00
vmwgfx_fb.c drm/vmwgfx: Remove the reservation semaphore 2021-05-11 13:37:15 -04:00
vmwgfx_fence.c drm/vmwgfx: Add basic support for SVGA3 2021-05-11 13:37:15 -04:00
vmwgfx_fence.h drm/vmwgfx: Add basic support for SVGA3 2021-05-11 13:37:15 -04:00
vmwgfx_gmr.c drm/vmwgfx: use min_t to replace min 2021-04-29 14:54:54 -04:00
vmwgfx_gmrid_manager.c drm/vmwgfx: Be a lot more flexible with MOB limits 2021-07-28 14:53:25 -04:00
vmwgfx_ioctl.c Revert "drm/vmwgfx: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()" 2021-10-04 09:34:56 -04:00
vmwgfx_irq.c drm/vmwgfx: Convert to Linux IRQ interfaces 2021-07-08 14:11:43 +02:00
vmwgfx_kms.c Revert "drm/vmwgfx: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()" 2021-10-04 09:34:56 -04:00
vmwgfx_kms.h drm/atomic: Pass the full state to planes atomic disable and update 2021-02-25 08:05:28 +01:00
vmwgfx_ldu.c drm/vmwgfx: Cleanup logging 2021-07-28 14:53:23 -04:00
vmwgfx_mksstat.h drm/vmwgfx: Introduce VMware mks-guest-stats 2021-06-12 00:00:53 -04:00
vmwgfx_mob.c drm/vmwgfx: Make use of PFN_ALIGN/PFN_UP helper macro 2021-08-09 17:30:34 -04:00
vmwgfx_msg_arm64.h drm/vmwgfx: Port vmwgfx to arm64 2021-05-11 13:37:16 -04:00
vmwgfx_msg_x86.h drm/vmwgfx: Port vmwgfx to arm64 2021-05-11 13:37:16 -04:00
vmwgfx_msg.c drm/vmwgfx: Replace "vmw_num_pages" with "PFN_UP" 2021-08-09 17:30:35 -04:00
vmwgfx_overlay.c drm/vmwgfx: Add basic support for SVGA3 2021-05-11 13:37:15 -04:00
vmwgfx_page_dirty.c drm/ttm: remove ttm_bo_vm_insert_huge() 2021-11-05 11:13:19 +01:00
vmwgfx_prime.c drm/vmwgfx: Delete mmaping functions 2019-11-25 22:36:14 +01:00
vmwgfx_reg.h drm/vmwgfx: Add basic support for SVGA3 2021-05-11 13:37:15 -04:00
vmwgfx_resource_priv.h drm/vmwgfx: Implement an infrastructure for read-coherent resources 2019-11-06 13:30:27 +01:00
vmwgfx_resource.c drm/vmwgfx: Make use of PFN_ALIGN/PFN_UP helper macro 2021-08-09 17:30:34 -04:00
vmwgfx_scrn.c drm/vmwgfx: Cleanup logging 2021-07-28 14:53:23 -04:00
vmwgfx_shader.c drm/vmwgfx: Make use of PFN_ALIGN/PFN_UP helper macro 2021-08-09 17:30:34 -04:00
vmwgfx_simple_resource.c drm/vmwgfx: Remove the reservation semaphore 2021-05-11 13:37:15 -04:00
vmwgfx_so.c drm/vmwgfx: Fix some static checker warnings 2021-06-12 00:00:59 -04:00
vmwgfx_so.h drm/vmwgfx: Add support for streamoutput with mob commands 2020-03-23 22:39:35 +01:00
vmwgfx_stdu.c drm/vmwgfx: Cleanup logging 2021-07-28 14:53:23 -04:00
vmwgfx_streamoutput.c drm/ttm: rename bo->mem and make it a pointer 2021-06-02 11:07:25 +02:00
vmwgfx_surface.c drm/vmwgfx: fix potential UAF in vmwgfx_surface.c 2021-08-09 17:30:34 -04:00
vmwgfx_thp.c drm/ttm: flip the switch for driver allocated resources v2 2021-06-04 15:16:46 +02:00
vmwgfx_ttm_buffer.c Merge drm/drm-next into drm-misc-next 2021-09-14 09:25:30 +02:00
vmwgfx_ttm_glue.c drm/ttm: remove ttm_bo_vm_insert_huge() 2021-11-05 11:13:19 +01:00
vmwgfx_va.c
vmwgfx_validation.c drm/vmwgfx: Fix some static checker warnings 2021-06-12 00:00:59 -04:00
vmwgfx_validation.h drm/vmwgfx: Implement an infrastructure for write-coherent resources 2019-11-06 13:04:54 +01:00