Subject: CVE-2024-46709: drm/vmwgfx: Fix prime with external buffers

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

drm/vmwgfx: Fix prime with external buffers

Make sure that for external buffers mapping goes through the dma_buf
interface instead of trying to access pages directly.

External buffers might not provide direct access to readable/writable
pages so to make sure the bo's created from external dma_bufs can be
read dma_buf interface has to be used.

Fixes crashes in IGT's kms_prime with vgem. Regular desktop usage won't
trigger this due to the fact that virtual machines will not have
multiple GPUs but it enables better test coverage in IGT.

The Linux kernel CVE team has assigned CVE-2024-46709 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.6.29 with commit 65674218b43f and fixed in 6.6.49 with commit 9a9716bbbf3d
	Issue introduced in 6.9 with commit b32233acceff and fixed in 6.10.8 with commit 5c12391ee1ab
	Issue introduced in 6.9 with commit b32233acceff and fixed in 6.11 with commit 50f119925091
	Issue introduced in 6.8.8 with commit 2cdb71c975a1

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-46709
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
	drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
	drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/9a9716bbbf3dd6b6cbefba3abcc89af8b72631f4
	https://git.kernel.org/stable/c/5c12391ee1ab59cb2f3be3f1f5e6d0fc0c2dc854
	https://git.kernel.org/stable/c/50f1199250912568606b3778dc56646c10cb7b04