crypto: ccp - Fix snp_filter_reserved_mem_regions() off-by-one
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
crypto: ccp - Fix snp_filter_reserved_mem_regions() off-by-one
Sashiko notes:
> regarding the bounds check in snp_filter_reserved_mem_regions() > called via walk_iomem_res_desc(): does the check > if ((range_list->num_elements * 16 + 8) > PAGE_SIZE) > allow an off-by-one heap buffer overflow? > > If range_list->num_elements is 255, 255 * 16 + 8 = 4088, which is <= 4096. > Writing range->base (8 bytes) fills 4088-4095, but writing range->page_count > (4 bytes) would write to 4096-4099, overflowing the kzalloc-allocated > PAGE_SIZE buffer.
Fix this by accounting for the entry about to be written to, in addition to the entries that are already allocated.
From the CVE record · Linux
The Linux kernel’s crypto ccp code has an off-by-one bounds check in snp_filter_reserved_mem_regions(). When 255 entries are already present, writing the next entry can overflow a page-sized heap buffer; the input does not establish how an attacker could trigger this or what access it requires.
Engineers running the Linux kernel should check whether their kernel includes the affected crypto ccp code; affected versions were not provided.