Skip to contentSkip to conversation

drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset

PATCH Superseded fausten 4 participants 14 messages Aug 23 – Oct 27

Subsystems (3)
lore
Share & tools
lore

fausten

author
#0 lore raw

PATCH 1/1 drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset

The cursor plane code validates cursor dimensions against SVGA_REG_CURSOR_MAX_DIMENSION before every cursor update, and rejects the update with -EINVAL if the cursor is larger than the reported maximum.

However, some SVGA implementations do not implement this register and return 0 for it. In that case every cursor update is rejected, and the log is spammed with:

[drm] Cursor dimensions (64, 64) exceed device max 0

The visible symptom is that the hardware cursor never appears at all on VMware Fusion guests (SVGA version 2), making the mouse pointer invisible even though the input devices work fine.

Treat a reported maximum of 0 as "not implemented" and skip the dimension check in that case, restoring the pre-existing behaviour of accepting the cursor.

Tested on VMware Fusion with an SVGA version 2 device where the cursor previously did not show up.

Fixes d5ed8749168a ("drm/vmwgfx: enforce cursor size limits for MOB cursors")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +8 -4
index d1e7df500..fbdd23ecb 100644
@@ -237,8 +237,10 @@ static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp,
 	mob_max_size = vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
 	cursor_max_dim = vmw_read(dev_priv, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-	if (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
-	    vps->base.crtc_h > cursor_max_dim)
+	/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */
+	if (cursor_max_dim &&
+	    (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
+	     vps->base.crtc_h > cursor_max_dim))
 		return -EINVAL;
 
 	if (vps->cursor.mob) {
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */
+		if (cursor_max_dim &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		    new_state->crtc_h > cursor_max_dim)) {
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,
Signature · 1 line
2.33.0
author
#1 lore raw

PATCH v2 1/1 drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset

The cursor plane code validates cursor dimensions against SVGA_REG_CURSOR_MAX_DIMENSION before every cursor update, and rejects the update with -EINVAL if the cursor is larger than the reported maximum.

However, some SVGA implementations do not implement this register and return 0 for it. In that case every cursor update is rejected, and the log is spammed with:

[drm] Cursor dimensions (64, 64) exceed device max 0

The visible symptom is that the hardware cursor never appears at all on VMware Fusion guests (SVGA version 2), making the mouse pointer invisible even though the input devices work fine.

Treat a reported maximum of 0 as "not implemented" and skip the dimension check in that case, restoring the pre-existing behaviour of accepting the cursor.

Tested on VMware Fusion with an SVGA version 2 device where the cursor previously did not show up.

Fixes d5ed8749168a ("drm/vmwgfx: enforce cursor size limits for MOB cursors")

---
Changes in v2:
- Fix author name and email address (v1 was sent with a wrong From).

 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +8 -4
index d1e7df500..fbdd23ecb 100644
@@ -237,8 +237,10 @@ static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp,
 	mob_max_size = vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
 	cursor_max_dim = vmw_read(dev_priv, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-	if (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
-	    vps->base.crtc_h > cursor_max_dim)
+	/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */
+	if (cursor_max_dim &&
+	    (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
+	     vps->base.crtc_h > cursor_max_dim))
 		return -EINVAL;
 
 	if (vps->cursor.mob) {
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */
+		if (cursor_max_dim &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		    new_state->crtc_h > cursor_max_dim)) {
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,
Signature · 1 line
2.33.0
#2 lore raw
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

Pre-existing issues:
- [Critical] Integer overflows in framebuffer creation and cursor command submission cause a Guest-to-Host Out-Of-Bounds Read.
- [High] Missing Error Handling / NULL Pointer Dereference in vmw_cursor_plane_prepare_fb.
- [High] State Confusion in vmw_cursor_plane_atomic_check allows bypassing legacy cursor dimension checks, leading to a massive kernel heap Out-Of-Bounds read. --

--- Patch [1]: [PATCH v2] drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset --- commit fc08a38eba647596145d861cab4214687c5ce5ce
Author: fausten <[email protected]>

drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset

This commit treats a reported SVGA_REG_CURSOR_MAX_DIMENSION of 0 as "not implemented" and skips the cursor dimension check in that case. This restores the pre-existing behaviour for VMware Fusion guests (SVGA version 2) where the cursor previously did not show up.

Quoted 4 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +0 -0
index d1e7df5001903..fbdd23ecb2b4b 100644

[ ... ]

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c int vmw_cursor_plane_atomic_check(struct drm_plane *plane, · line 756

Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +4 -2
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */
+		if (cursor_max_dim &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		    new_state->crtc_h > cursor_max_dim)) {

[Severity: High]
This isn't a bug introduced by this patch, but does the cursor plane code handle BO mapping failures safely?

In drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c:vmw_cursor_plane_prepare_fb(), the return value of vmw_bo_map_and_cache_size() is cast to void, ignoring potential mapping failures:

    (void)vmw_bo_map_and_cache_size(bo, size);

If this mapping fails, bo->map.virtual remains NULL. Later, in vmw_cursor_plane_atomic_update(), vmw_send_define_cursor_cmd() unconditionally copies to the command buffer using the unvalidated image pointer:

    memcpy(&cmd[1], image, image_size);

Could this cause a NULL pointer dereference and kernel panic if memory pressure causes the mapping to fail?

[Severity: High]
This is a pre-existing issue, but does skipping this dimension check expose a state confusion bug that could lead to an out-of-bounds read?

In drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c:vmw_cursor_plane_atomic_check(), update_type is evaluated using vmw_cursor_update_type(vmw, vps). At this point, vps->uo contains stale state from the previous commit, as it isn't updated until vmw_cursor_plane_prepare_fb().

If userspace commits a BO-backed cursor (GB_ONLY), and then in a subsequent commit submits a Surface-backed cursor (LEGACY) with huge dimensions (e.g., 512x512), atomic_check will evaluate the type as GB_ONLY.

Since this patch skips the dimension check when cursor_max_dim == 0, the huge dimensions are accepted. When prepare_fb() runs, vps->uo is updated and the type correctly becomes LEGACY.

Finally, in vmw_send_define_cursor_cmd(), the memcpy() reads width * height * 4 bytes from the 16KB legacy surface->snooper.image buffer:

    memcpy(&cmd[1], image, image_size);

Could this result in a massive out-of-bounds read of the kernel heap being sent to the hypervisor?

[Severity: Critical]
This is a pre-existing issue, but does bypassing this check when cursor_max_dim == 0 expose integer overflows that can cause a guest-to-host out-of-bounds read?

If userspace creates a framebuffer with massive dimensions (e.g., 32768x32768), the calculation in drivers/gpu/drm/vmwgfx/vmwgfx_kms.c:vmw_kms_new_framebuffer_bo() overflows 32 bits:

    requested_size = mode_cmd->height * mode_cmd->pitches[0];
    if (unlikely(requested_size > bo->tbo.base.size)) {

This overflow to 0 allows creating a massive framebuffer with a 1-page BO. Because this patch removes the dimension limit for cursor_max_dim == 0, the large cursor dimensions are accepted.

When vmw_send_define_cursor_cmd() prepares the command:

    const u32 image_size = width * height * sizeof(*image);
    const u32 cmd_size = sizeof(*cmd) + image_size;

image_size overflows to 0, resulting in only sizeof(*cmd) bytes being allocated in the command FIFO. The hypervisor receives the command specifying a 32768x32768 cursor but no pixel data follows in the FIFO.

Will this cause the hypervisor to read 4GB out-of-bounds from the command FIFO?

Quoted 3 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +0 -0
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw
In reply to fausten
Quoted 15 lines · fausten

The cursor plane code validates cursor dimensions against SVGA_REG_CURSOR_MAX_DIMENSION before every cursor update, and rejects the update with -EINVAL if the cursor is larger than the reported maximum.

However, some SVGA implementations do not implement this register and return 0 for it. In that case every cursor update is rejected, and the log is spammed with:

[drm] Cursor dimensions (64, 64) exceed device max 0

The visible symptom is that the hardware cursor never appears at all on VMware Fusion guests (SVGA version 2), making the mouse pointer invisible even though the input devices work fine.

Quoted 6 lines

Treat a reported maximum of 0 as "not implemented" and skip the dimension check in that case, restoring the pre-existing behaviour of accepting the cursor.

Tested on VMware Fusion with an SVGA version 2 device where the cursor previously did not show up.

I take it this is an x86_64 mac? What version of fusion are you using? Also what is the hwVersion of your VM?

Quoted 40 lines
Fixes d5ed8749168a ("drm/vmwgfx: enforce cursor size limits for MOB cursors")

---
Changes in v2:
- Fix author name and email address (v1 was sent with a wrong From).

 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +8 -4
index d1e7df500..fbdd23ecb 100644
@@ -237,8 +237,10 @@ static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp,
 	mob_max_size = vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
 	cursor_max_dim = vmw_read(dev_priv, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-	if (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
-	    vps->base.crtc_h > cursor_max_dim)
+	/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */
+	if (cursor_max_dim &&
+	    (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
+	     vps->base.crtc_h > cursor_max_dim))
 		return -EINVAL;
 
 	if (vps->cursor.mob) {
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */
+		if (cursor_max_dim &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		    new_state->crtc_h > cursor_max_dim)) {
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,
Signature · 1 line
Maaz Mombasawala <[email protected]>
#4 lore raw
In reply to fausten
Quoted 36 lines · fausten

The cursor plane code validates cursor dimensions against SVGA_REG_CURSOR_MAX_DIMENSION before every cursor update, and rejects the update with -EINVAL if the cursor is larger than the reported maximum.

However, some SVGA implementations do not implement this register and return 0 for it. In that case every cursor update is rejected, and the log is spammed with:

[drm] Cursor dimensions (64, 64) exceed device max 0

The visible symptom is that the hardware cursor never appears at all on VMware Fusion guests (SVGA version 2), making the mouse pointer invisible even though the input devices work fine.

Treat a reported maximum of 0 as "not implemented" and skip the dimension check in that case, restoring the pre-existing behaviour of accepting the cursor.

Tested on VMware Fusion with an SVGA version 2 device where the cursor previously did not show up.

Fixes d5ed8749168a ("drm/vmwgfx: enforce cursor size limits for MOB cursors")

---
Changes in v2:
- Fix author name and email address (v1 was sent with a wrong From).

 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +0 -0
index d1e7df500..fbdd23ecb 100644

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp, · line 240

Quoted 6 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +1 -2
@@ -237,8 +237,10 @@ static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp,
 	mob_max_size = vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
 	cursor_max_dim = vmw_read(dev_priv, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-	if (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
-	    vps->base.crtc_h > cursor_max_dim)
+	/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */

The issue here is not with vmware fusion but the hw version, SVGA_REG_CURSOR_MAX_DIMENSION requires cursor mobs, which are available only on hw versions 18 and above. Please correct the comment here and below to reflect that.

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp, · line 241

Quoted 1 line
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +1 -0
+	if (cursor_max_dim &&

Could you instead do cursor_max_dim > 0 here and below.

Quoted 18 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +6 -2
+	    (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
+	     vps->base.crtc_h > cursor_max_dim))
 		return -EINVAL;
 
 	if (vps->cursor.mob) {
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Some SVGA implementations (e.g. VMware Fusion) report 0 here. */
+		if (cursor_max_dim &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		    new_state->crtc_h > cursor_max_dim)) {
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,
Signature · 1 line
Maaz Mombasawala <[email protected]>
author
#5 lore raw

PATCH v4 1/1 drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset

The cursor plane code validates cursor dimensions against SVGA_REG_CURSOR_MAX_DIMENSION before every cursor update, and rejects the update with -EINVAL if the cursor is larger than the reported maximum.

However, this register is only available on hardware versions 18 and above, which introduced cursor MOBs. Older hardware (e.g. a VMware Fusion guest with SVGA version 2) returns 0 for it. In that case every cursor update is rejected,
and the log is spammed with:

[drm] Cursor dimensions (64, 64) exceed device max 0

The visible symptom is that the hardware cursor never appears at all on VMware Fusion guests (SVGA version 2), making the mouse pointer invisible even though the input devices work fine.

Treat a reported maximum of 0 as "not implemented" and skip the dimension check in that case, restoring the pre-existing behaviour of accepting the cursor.

Tested on VMware Fusion with an SVGA version 2 device where the cursor previously did not show up.

Fixes d5ed8749168a ("drm/vmwgfx: enforce cursor size limits for MOB cursors")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

---
Changes in v3:
- Use an explicit cursor_max_dim > 0 comparison (Maaz).
- Fix the comments: the register requires cursor MOBs which exist only on hw version 18 and above; it is not Fusion-specific (Maaz).

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +8 -4
index d1e7df500..3d4660684 100644
@@ -237,8 +237,10 @@ static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp,
 	mob_max_size = vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
 	cursor_max_dim = vmw_read(dev_priv, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-	if (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
-	    vps->base.crtc_h > cursor_max_dim)
+	/* Cursor MOBs, and thus this register, exist only on hw version 18+. */
+	if (cursor_max_dim > 0 &&
+	    (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
+	     vps->base.crtc_h > cursor_max_dim))
 		return -EINVAL;
 
 	if (vps->cursor.mob) {
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Cursor MOBs, and thus this register, exist only on hw version 18+. */
+		if (cursor_max_dim > 0 &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		     new_state->crtc_h > cursor_max_dim)) {
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,
Signature · 1 line
2.33.0
#6 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The patch incorrectly groups the `mob_max_size` validation under the `cursor_max_dim > 0` condition…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch incorrectly groups the mob_max_size validation under the cursor_max_dim > 0 condition in vmw_cursor_mob_get(). --

commit 4e542ce85fcba71b4d6d0cd77e13a02898b305c1

Author: fausten <[email protected]>
Date:   Sun Aug 30 15:16:19 2026 +0000

drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset

This commit modifies the cursor plane validation to treat a reported SVGA_REG_CURSOR_MAX_DIMENSION of 0 as "not implemented". This restores the hardware cursor visibility on older SVGA version 2 guests.

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp, · line 243

Quoted 13 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +4 -2
@@ -237,8 +237,10 @@ static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp,
 	mob_max_size = vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
 	cursor_max_dim = vmw_read(dev_priv, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-	if (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
-	    vps->base.crtc_h > cursor_max_dim)
+	/* Cursor MOBs, and thus this register, exist only on hw version 18+. */
+	if (cursor_max_dim > 0 &&
+	    (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
+	     vps->base.crtc_h > cursor_max_dim))

[Severity: Low]
Does this incorrectly bypass the mob_max_size check when cursor_max_dim evaluates to 0?

The parentheses group size > mob_max_size with the cursor dimension checks. If cursor_max_dim is 0, the logical AND fails early, which completely skips checking if the size exceeds mob_max_size in vmw_cursor_mob_get().

While this shouldn't cause an immediate out-of-bounds update since vmw_cursor_plane_atomic_check() independently validates mob_max_size, should the mob_max_size check remain separate from the cursor_max_dim validation to ensure it is always evaluated here?

Quoted 3 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +0 -0
 		return -EINVAL;
 
 	if (vps->cursor.mob) {

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#7 lore raw
In reply to fausten
Quoted 57 lines · fausten

The cursor plane code validates cursor dimensions against SVGA_REG_CURSOR_MAX_DIMENSION before every cursor update, and rejects the update with -EINVAL if the cursor is larger than the reported maximum.

However, this register is only available on hardware versions 18 and above, which introduced cursor MOBs. Older hardware (e.g. a VMware Fusion guest with SVGA version 2) returns 0 for it. In that case every cursor update is rejected,
and the log is spammed with:

[drm] Cursor dimensions (64, 64) exceed device max 0

The visible symptom is that the hardware cursor never appears at all on VMware Fusion guests (SVGA version 2), making the mouse pointer invisible even though the input devices work fine.

Treat a reported maximum of 0 as "not implemented" and skip the dimension check in that case, restoring the pre-existing behaviour of accepting the cursor.

Tested on VMware Fusion with an SVGA version 2 device where the cursor previously did not show up.

Fixes d5ed8749168a ("drm/vmwgfx: enforce cursor size limits for MOB cursors")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

---
Changes in v3:
- Use an explicit cursor_max_dim > 0 comparison (Maaz).
- Fix the comments: the register requires cursor MOBs which exist only on hw version 18 and above; it is not Fusion-specific (Maaz).

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +4 -2
index d1e7df500..3d4660684 100644
@@ -237,8 +237,10 @@ static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp,
 	mob_max_size = vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
 	cursor_max_dim = vmw_read(dev_priv, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-	if (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
-	    vps->base.crtc_h > cursor_max_dim)
+	/* Cursor MOBs, and thus this register, exist only on hw version 18+. */
+	if (cursor_max_dim > 0 &&
+	    (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
+	     vps->base.crtc_h > cursor_max_dim))
 		return -EINVAL;
 
 	if (vps->cursor.mob) {
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c int vmw_cursor_plane_atomic_check(struct drm_plane *plane, · line 759

Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +4 -2
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Cursor MOBs, and thus this register, exist only on hw version 18+. */
+		if (cursor_max_dim > 0 &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		     new_state->crtc_h > cursor_max_dim)) {
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,

This patch bricked my testing VM, investigating..

Signature · 1 line
Maaz Mombasawala <[email protected]>
author
#8 lore raw

From: fausten <[email protected]>

Quoted 1 line · Maaz Mombasawala

This patch bricked my testing VM, investigating..

Hi Maaz, hi Zack,

Just a gentle ping on this one. Maaz, did the investigation into your bricked testing VM turn up anything in the meantime?

Meanwhile I've done more testing on my side. I applied this fix on top of mainline 7.3 and the cursor works correctly again:

Host: VMware Fusion 26.0.1 on macOS 26.7.1 (x86_64)
Guest: Kylin Linux Advanced Server V10 (Halberd)
Kernel: 7.3 + this patch

Before the patch, every cursor update was rejected with -EINVAL because SVGA_REG_CURSOR_MAX_DIMENSION reads back 0 on this setup; with the patch applied, cursor updates go through normally again. 3D acceleration is disabled in the VM settings.

So far I haven't been able to reproduce the failure you reported. If you can share your test environment (hypervisor product and version, host OS, guest kernel, 3D acceleration on/off) and the failure symptoms (boot hang vs. cursor path only), I'd like to narrow down what's different between our setups.

And if the conclusion is that treating 0 as "unset" with the current fallback isn't the right fix, I'm happy to rework it as a v5.

Thanks,
fausten

author
#10 lore raw
Quoted 9 lines · On Sat, Oct 24, 2026 at 7:37 AM Maaz Mombasawala <…

Hi fausten,

Sorry for not following up on this patch, I did not get time to do so. Will get back to it shortly.

--
Maaz Mombasawala <[email protected]>

Hi Maaz,
No worries, thanks for the update.

Thanks,
fausten

maintainer
#11 lore raw
Quoted 7 lines · Li Yunfeng
Quoted 6 lines · On Sat, Oct 24, 2026 at 7:37 AM Maaz Mombasawala…

Hi fausten,

Sorry for not following up on this patch, I did not get time to do so. Will get back to it shortly.

Quoted 6 lines
Quoted 3 lines

--
Maaz Mombasawala <[email protected]>

Hi Maaz,
No worries, thanks for the update.

Thank you for the patch. I was looking at various cursor issues and I've fixed this particular bug differently. If you have a minute I'd appreciate it if you could try the series I sent out a few minutes ago (you were cc'ed on it) to make sure everything works with it.

z

author
#12 lore raw

PATCH v3 1/1 drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset

In reply to fausten

From: Yunfeng Li <[email protected]>

The cursor plane code validates cursor dimensions against SVGA_REG_CURSOR_MAX_DIMENSION before every cursor update, and rejects the update with -EINVAL if the cursor is larger than the reported maximum.

However, this register is only available on hardware versions 18 and above, which introduced cursor MOBs. Older hardware (e.g. a VMware Fusion guest with SVGA version 2) returns 0 for it. In that case every cursor update is rejected,
and the log is spammed with:

[drm] Cursor dimensions (64, 64) exceed device max 0

The visible symptom is that the hardware cursor never appears at all on VMware Fusion guests (SVGA version 2), making the mouse pointer invisible even though the input devices work fine.

Treat a reported maximum of 0 as "not implemented" and skip the dimension check in that case, restoring the pre-existing behaviour of accepting the cursor.

Tested on VMware Fusion with an SVGA version 2 device where the cursor previously did not show up.

Fixes d5ed8749168a ("drm/vmwgfx: enforce cursor size limits for MOB cursors")

---
Changes in v3:
- Use an explicit cursor_max_dim > 0 comparison (Zack Rusin).
- Fix the comments: the register requires cursor MOBs which exist only on hw version 18 and above; it is not Fusion-specific (Zack Rusin).

 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +8 -4
index d1e7df500..3d4660684 100644
@@ -237,8 +237,10 @@ static int vmw_cursor_mob_get(struct vmw_cursor_plane *vcp,
 	mob_max_size = vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
 	cursor_max_dim = vmw_read(dev_priv, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-	if (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
-	    vps->base.crtc_h > cursor_max_dim)
+	/* Cursor MOBs, and thus this register, exist only on hw version 18+. */
+	if (cursor_max_dim > 0 &&
+	    (size > mob_max_size || vps->base.crtc_w > cursor_max_dim ||
+	     vps->base.crtc_h > cursor_max_dim))
 		return -EINVAL;
 
 	if (vps->cursor.mob) {
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Cursor MOBs, and thus this register, exist only on hw version 18+. */
+		if (cursor_max_dim > 0 &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		     new_state->crtc_h > cursor_max_dim)) {
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,
Signature · 1 line
2.33.0
#13 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Bypassing the `cursor_max_dim` check for older hardware removes all size limits for…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Bypassing the cursor_max_dim check for older hardware removes all size limits for VMW_CURSOR_UPDATE_GB_ONLY cursors, leading to kernel deadlocks. --

commit 40fdf3cf95cd9e88874c6ede6ef6e1bfc8402258
Author: Yunfeng Li <[email protected]>

drm/vmwgfx: Treat zero SVGA_REG_CURSOR_MAX_DIMENSION as unset

This commit modifies the cursor plane validation to skip the maximum dimension check if the hardware reports a maximum of 0 (like SVGA version 2). This fixes an issue on VMware Fusion guests where the hardware cursor would fail to appear due to the register not being implemented.

Quoted 3 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +0 -0

[ ... ]

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c int vmw_cursor_plane_atomic_check(struct drm_plane *plane, · line 756

Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +4 -2
@@ -748,8 +750,10 @@ int vmw_cursor_plane_atomic_check(struct drm_plane *plane,
 		u32 cursor_max_dim =
 			vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
 
-		if (new_state->crtc_w > cursor_max_dim ||
-		    new_state->crtc_h > cursor_max_dim) {
+		/* Cursor MOBs, and thus this register, exist only on hw version 18+. */
+		if (cursor_max_dim > 0 &&
+		    (new_state->crtc_w > cursor_max_dim ||
+		     new_state->crtc_h > cursor_max_dim)) {

[Severity: High]
Does skipping this dimension check when cursor_max_dim is 0 allow userspace to request arbitrarily large cursors?

If a user requests a massive cursor (e.g., 4096x4096), this check is bypassed and the update proceeds. Later, vmw_send_define_cursor_cmd() attempts to allocate a command buffer for the cursor:

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c:vmw_send_define_cursor_cmd() {
    ...
    const u32 image_size = width * height * sizeof(*image);
    const u32 cmd_size = sizeof(*cmd) + image_size;

    cmd = VMW_CMD_RESERVE(dev_priv, cmd_size);
    ...
}

For a 4096x4096 cursor, this results in a ~64MB allocation request. Since this requested size vastly exceeds the typical command buffer pool, does this cause the internal allocator to stall indefinitely?

drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:vmw_cmdbuf_alloc_space() {
    ...
    } else {
        wait_event(man->alloc_queue, vmw_cmdbuf_try_alloc(man, &info));
    }
    ...
}

Because the space can never become available for such a large allocation, it appears this creates an uninterruptible deadlock in the DRM KMS subsystem.

Quoted 3 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +0 -0
 			drm_warn(&vmw->drm,
 				 "Cursor dimensions (%d, %d) exceed device max %u\n",
 				 new_state->crtc_w, new_state->crtc_h,
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1