dma-buf: heaps: Fix off-by-one in CMA heap fault handler
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:
dma-buf: heaps: Fix off-by-one in CMA heap fault handler
Until VM_DONTEXPAND was added in commit 1c1914d6e8c6 ("dma-buf: heaps: Don't track CMA dma-buf pages under RssFile") it was possible to obtain a mapping larger than the buffer size via mremap and bypass the overflow check in dma_buf_mmap_internal. When using such a mapping to attempt to fault past the end of the buffer, the CMA heap fault handler also checks the fault offset against the buffer size, but gets the boundary wrong by 1. Fix the boundary check so that we don't read off the end of the pages array and insert an arbitrary page in the mapping.
From the CVE record · Linux
The Linux kernel’s CMA heap fault handler has an off-by-one boundary check. A local attacker who can create an oversized buffer mapping with mremap could fault past the buffer’s end, causing the handler to read beyond its pages array and insert an arbitrary page into the mapping. Authentication and user-interaction requirements are not specified.
Engineers running Linux kernels with the affected CMA heap fault handler should check their versions; affected versions are not specified.