cve/2024/CVE-2024-56544.md
2025-09-29 16:08:36 +00:00

1.9 KiB

CVE-2024-56544

Description

In the Linux kernel, the following vulnerability has been resolved:udmabuf: change folios array from kmalloc to kvmallocWhen PAGE_SIZE 4096, MAX_PAGE_ORDER 10, 64bit machine,page_alloc only support 4MB.If above this, trigger this warn and return NULL.udmabuf can change size limit, if change it to 3072(3GB), and then alloc3GB udmabuf, will fail create.[ 4080.876581] ------------[ cut here ]------------[ 4080.876843] WARNING: CPU: 3 PID: 2015 at mm/page_alloc.c:4556 __alloc_pages+0x2c8/0x350[ 4080.878839] RIP: 0010:__alloc_pages+0x2c8/0x350[ 4080.879470] Call Trace:[ 4080.879473] [ 4080.879473] ? __alloc_pages+0x2c8/0x350[ 4080.879475] ? __warn.cold+0x8e/0xe8[ 4080.880647] ? __alloc_pages+0x2c8/0x350[ 4080.880909] ? report_bug+0xff/0x140[ 4080.881175] ? handle_bug+0x3c/0x80[ 4080.881556] ? exc_invalid_op+0x17/0x70[ 4080.881559] ? asm_exc_invalid_op+0x1a/0x20[ 4080.882077] ? udmabuf_create+0x131/0x400Because MAX_PAGE_ORDER, kmalloc can max alloc 4096 * (1 << 10), 4MBmemory, each array entry is pointer(8byte), so can save 524288 pages(2GB).Further more, costly order(order 3) may not be guaranteed that it can beapplied for, due to fragmentation.This patch change udmabuf array use kvmalloc_array, this can fallbackalloc into vmalloc, which can guarantee allocation for any size and doesnot affect the performance of kmalloc allocations.

POC

Reference

No PoCs from references.

Github