Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1F931E485 for ; Fri, 27 Dec 2024 14:11:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735308713; cv=none; b=YfVkV373b88q35Mc5aN61Krw9FELN1h3aKKgGtlhfv8eak4ynKO7oJGCE2c26l4gFxfOcISqT9O+1MITsWUR7jKvE52Fw+zm2Mt0HVI+z6w9q99kB7kromhHX3aYjwjU36KAIvwQd91WcCjNq+jNynO5xofCwZFcZfvDnzGnJ4Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735308713; c=relaxed/simple; bh=ek4J3T0Wx8EvPhrB7tTgXlRf65siPbNuOfBYw6jQfCA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hb+F+Am71mi61qbCkvIMBpTtnFu9chBjLwbNsw/pCItd5bbapGkbNqj+GT16etiQnvu2j0vooThDPeO5DVOn4m5UqtX/5fsI7w+lxlYMxYZEYlwaWivl32NYgBrIf4TKJAZwSAiz+prXLjistHA3k1sb1+nG3DUOCi+jTqr+A70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Mfzs1Lud; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Mfzs1Lud" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3058DC4CED0; Fri, 27 Dec 2024 14:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735308712; bh=ek4J3T0Wx8EvPhrB7tTgXlRf65siPbNuOfBYw6jQfCA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=Mfzs1Lud7P2P3fSSOznZbX1zxVFlP/5LwaZNG8hbmr25jRM6EzIB/4PycINEhjrsG Jp7HeOI+oaZ7vEMfjEawyRsR6lw3D886dYhY3aPf/rgFxFNonaLjeKr3CeUHHK0SK5 yKDaN/hP7BrsxZTG4ZRVcx3NP6TmhOUloF0Lq0vQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56544: udmabuf: change folios array from kmalloc to kvmalloc Date: Fri, 27 Dec 2024 15:11:35 +0100 Message-ID: <2024122728-CVE-2024-56544-42cf@gregkh> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3051; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ek4J3T0Wx8EvPhrB7tTgXlRf65siPbNuOfBYw6jQfCA=; b=owGbwMvMwCRo6H6F97bub03G02pJDOl5WydsbdW5131hVc8npffTGN9WBlk0+Ec/zPKp7WLPX v728cObHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRyZ4M8yODI/6uZ997/NSF 36k8Gw8tvmOXV8ww32vR4ofcR1eZzn0lO3/1+3fVu4LeHQcA X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: udmabuf: change folios array from kmalloc to kvmalloc When 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 alloc 3GB 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/0x400 Because MAX_PAGE_ORDER, kmalloc can max alloc 4096 * (1 << 10), 4MB memory, 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 be applied for, due to fragmentation. This patch change udmabuf array use kvmalloc_array, this can fallback alloc into vmalloc, which can guarantee allocation for any size and does not affect the performance of kmalloc allocations. The Linux kernel CVE team has assigned CVE-2024-56544 to this issue. Affected and fixed versions =========================== Fixed in 6.11.11 with commit 2acc6192aa8570661ed37868c02c03002b1dc290 Fixed in 6.12.2 with commit 85bb72397cb63649fe493c96e27e1d0e4ed2ff63 Fixed in 6.13-rc1 with commit 1c0844c6184e658064e14c4335885785ad3bf84b Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-56544 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/dma-buf/udmabuf.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/2acc6192aa8570661ed37868c02c03002b1dc290 https://git.kernel.org/stable/c/85bb72397cb63649fe493c96e27e1d0e4ed2ff63 https://git.kernel.org/stable/c/1c0844c6184e658064e14c4335885785ad3bf84b