drm/vmwgfx: use check_add_overflow for shader size+offset bound
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
drm/vmwgfx: use check_add_overflow for shader size+offset bound
vmw_shader_define() validates the user-supplied shader window against its backing buffer with
(u64)buffer->tbo.base.size < (u64)size + (u64)offset
drm_vmw_shader_create_arg::offset is __u64 in the uapi; when it is near U64_MAX the unsigned addition wraps and the resulting tiny value passes the check. The unbounded offset is then stored in res->guest_memory_offset and forwarded to host SVGA shader-create commands.
Use check_add_overflow() to detect the wrap and compare the resulting endpoint against the buffer size.
From the CVE record · Linux
The vmwgfx shader creation check can accept an offset near U64_MAX because adding the shader size wraps around. A user who supplies that offset can cause an out-of-bounds offset to be forwarded to a host SVGA shader-create command; authentication and user-interaction requirements are not specified.
Anyone running a Linux kernel with the affected vmwgfx code should check their kernel; affected versions are not specified.