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 4C19A433C8 for ; Thu, 27 Feb 2025 02:18:57 +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=1740622737; cv=none; b=Rkpb4qDxX4ms8ve0ehiBNg19uPU71LvuJ5jQrBZP578mQCxHJojl9kaSJCiY0fTVlmVShP0HGCgiEDdEKwUqEMEIceVGSL+2+YtgLnfXqoemBnoftxxfs0SwiC2MqcSgyaGMll2ryiix5xeBPseHZjcZb1+XuCzyGgCKCY35BLI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740622737; c=relaxed/simple; bh=5a447qMphlC8nTqZbtXmamfy/VcWV1tyQ9Ip7HEw8gg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HOa+8eVaMAbnoqrvwQ568PKlN4P3hUuISPuSE9U6JGRaInG7SyuKTeSDYHZcOfHal1UzkmUxemzXRHCbt13ds9Nh2iqCAixoAqT7y/caK1b+VyaUZg0QdKCrHDF0Xdg5UPWNN0sOvToKmEsMckZsZZpca+1+w1cCPRWYzlLbgq4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XJDpHujr; 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="XJDpHujr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F225C4CED6; Thu, 27 Feb 2025 02:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740622737; bh=5a447qMphlC8nTqZbtXmamfy/VcWV1tyQ9Ip7HEw8gg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=XJDpHujrTi2pzHavANRVoagkXzOtHj57lh2Jv5lr2o/rZYIm12Po29o3m2wLgUaC6 pN6PHDU2HwzSQp5T14QjZ9KRYxr1goGCng9EdiNVVpo7sSmdiw5XxIIybleQ4gtyZb heFqbIg9h1YvaU+9K0tGUVOLP5Nzqz5KPtQZs/f0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21777: ring-buffer: Validate the persistent meta data subbuf array Date: Wed, 26 Feb 2025 18:17:33 -0800 Message-ID: <2025022607-CVE-2025-21777-0c96@gregkh> X-Mailer: git-send-email 2.48.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=3175; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=5a447qMphlC8nTqZbtXmamfy/VcWV1tyQ9Ip7HEw8gg=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7TytbmTRKtO+IVitpcDUzC20221F8vMHh3pLZhduOT vDc01vUEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABNJlGCYn3j+nMMaAynv+7H+ qyeb3so+9y1UimHBBJ7vjHz2jOnn81Y0xpyevC9TM9ASAA== 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: ring-buffer: Validate the persistent meta data subbuf array The meta data for a mapped ring buffer contains an array of indexes of all the subbuffers. The first entry is the reader page, and the rest of the entries lay out the order of the subbuffers in how the ring buffer link list is to be created. The validator currently makes sure that all the entries are within the range of 0 and nr_subbufs. But it does not check if there are any duplicates. While working on the ring buffer, I corrupted this array, where I added duplicates. The validator did not catch it and created the ring buffer link list on top of it. Luckily, the corruption was only that the reader page was also in the writer path and only presented corrupted data but did not crash the kernel. But if there were duplicates in the writer side, then it could corrupt the ring buffer link list and cause a crash. Create a bitmask array with the size of the number of subbuffers. Then clear it. When walking through the subbuf array checking to see if the entries are within the range, test if its bit is already set in the subbuf_mask. If it is, then there is duplicates and fail the validation. If not, set the corresponding bit and continue. The Linux kernel CVE team has assigned CVE-2025-21777 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12 with commit c76883f18e59b762247ee91d3e4224231711854e and fixed in 6.12.16 with commit 3ec743d558f111d8999aea24577ba66c65ee2eeb Issue introduced in 6.12 with commit c76883f18e59b762247ee91d3e4224231711854e and fixed in 6.13.4 with commit 0d547a6f5e8fad26ebc12f501d7d19fccdbad6bf Issue introduced in 6.12 with commit c76883f18e59b762247ee91d3e4224231711854e and fixed in 6.14-rc3 with commit f5b95f1fa2ef3a03f49eeec658ba97e721412b32 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-2025-21777 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: kernel/trace/ring_buffer.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/3ec743d558f111d8999aea24577ba66c65ee2eeb https://git.kernel.org/stable/c/0d547a6f5e8fad26ebc12f501d7d19fccdbad6bf https://git.kernel.org/stable/c/f5b95f1fa2ef3a03f49eeec658ba97e721412b32