diff options
| author | Zack Rusin <zack.rusin@broadcom.com> | 2026-10-26 23:15:33 -0400 |
|---|---|---|
| committer | Zack Rusin <zack.rusin@broadcom.com> | 2026-11-16 15:09:30 -0500 |
| commit | c1e6267b9dd3e04f9dc29e500414cc4fc237dec1 (patch) | |
| tree | 5659a5955458e1c1659643561ddb5c53569b1f56 /rust/kernel/alloc | |
| parent | 06069d6d650dbef746eb933e2f4fbfc686b6d330 (diff) | |
drm/vmwgfx: validate backup buffer size in command buffer processing
vmw_cmd_res_switch_backup lets userspace bind an arbitrary MOB to a
resource without checking that the MOB is large enough for the resource's
guest_memory_size. The dirty-tracking bitmap is allocated based on the
MOB size, but later accessed using the (larger) surface size, causing an
out-of-bounds write in the bitmap that corrupts adjacent slab memory.
Add a check that backup_offset + res->guest_memory_size does not exceed
the buffer size before allowing the backup switch.
DX shaders and stream outputs never set guest_memory_size, and both were
allocated with kmalloc(), so the check would read uninitialized memory for
SVGA_3D_CMD_DX_BIND_SHADER and SVGA_3D_CMD_DX_BIND_STREAMOUTPUT and could
reject valid binds. Allocate both with kzalloc() so their
guest_memory_size is 0 and the check only bounds the offset.
Fixes: a97e21923b42 ("drm/vmwgfx: Hook up guest-backed surfaces")
Cc: stable@vger.kernel.org
Reported-by: Zero Day Initiative <zdi-disclosures@trendmicro.com> # ZDI-CAN-34068
Closes: https://lore.kernel.org/all/BYAPR01MB38301CFC012E873340F77E3D80662@BYAPR01MB3830.prod.exchangelabs.com/
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
Link: https://patch.msgid.link/20261027031533.2241918-1-zack.rusin@broadcom.com
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions
