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 E15EE1A38F4 for ; Wed, 11 Sep 2024 15:14:26 +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=1726067667; cv=none; b=gc1mQsuCMjy11zvLIPgH8Mtcfa98viV4WvuaZdRPMJ8y3xD9XhyrAQldmHEVM3MhoHe6/fAu6wHjohwcTOKFciR/CIOr1wIjvNzqmzSOfv/PvIoQPOqnRK3nFR5ldeEFm7Pzj+/Tahw6lm8xFG3SRKeMW8CroNJBuLuLBm7TqtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726067667; c=relaxed/simple; bh=ltJb6w6hUq7hOi9IKsR8Nk9RVdnDmx50KWWkRq5ogiE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TNprdBPyHk9oInv6RGvv4GMSZjVAjm5aaWGpVkqsTqI8F2iHac2y1Ayh7KkT1I768YC6vsDFiJm/u1jip4UghOlU5hwVjLwVQ5HFvsoH/2Fn+NV+fbqmYWjaW88AlwIERf1KpYw2zGhlePTPRyd2cyEwCdX0ZUiTZW6ROAJCXqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ScaPJNEt; 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="ScaPJNEt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D28DC4CEC7; Wed, 11 Sep 2024 15:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1726067666; bh=ltJb6w6hUq7hOi9IKsR8Nk9RVdnDmx50KWWkRq5ogiE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=ScaPJNEtTw5t/xP3qx2mqw0NAscsUIRsG5/eB0U0AQ0l1eCGrUUH5Fn5LEmdSkTJF A9Vti03dgcf+6DxLPBaY+UKyPYx5LocM7nUV0MggWJz3fmNAlPIu7PwlzhIsSZLwAw n4JCV+iQWs2clAgtkX3IFBCKvC8wfTtcDFATKTvo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-45020: bpf: Fix a kernel verifier crash in stacksafe() Date: Wed, 11 Sep 2024 17:14:16 +0200 Message-ID: <2024091108-CVE-2024-45020-afcc@gregkh> X-Mailer: git-send-email 2.46.0 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=2527; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ltJb6w6hUq7hOi9IKsR8Nk9RVdnDmx50KWWkRq5ogiE=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkPNx9s//L6vaN1yp1rbIfMvpmrHUuJvSi9y1tiQwhHS aC/WoR5RywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEykVIFhnkYW25Lfp75/F6nf Mq1X/vq8yL+/Ihjml9nrWHbsaJq+84qJ+C2DV9MvWW7fBwA= 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: bpf: Fix a kernel verifier crash in stacksafe() Daniel Hodges reported a kernel verifier crash when playing with sched-ext. Further investigation shows that the crash is due to invalid memory access in stacksafe(). More specifically, it is the following code: if (exact != NOT_EXACT && old->stack[spi].slot_type[i % BPF_REG_SIZE] != cur->stack[spi].slot_type[i % BPF_REG_SIZE]) return false; The 'i' iterates old->allocated_stack. If cur->allocated_stack < old->allocated_stack the out-of-bound access will happen. To fix the issue add 'i >= cur->allocated_stack' check such that if the condition is true, stacksafe() should fail. Otherwise, cur->stack[spi].slot_type[i % BPF_REG_SIZE] memory access is legal. The Linux kernel CVE team has assigned CVE-2024-45020 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6.15 with commit ab470fefce28 and fixed in 6.6.48 with commit 7cad3174cc79 Issue introduced in 6.7 with commit 2793a8b015f7 and fixed in 6.10.7 with commit 6e3987ac310c Issue introduced in 6.7 with commit 2793a8b015f7 and fixed in 6.11-rc4 with commit bed2eb964c70 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-45020 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/bpf/verifier.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/7cad3174cc79519bf5f6c4441780264416822c08 https://git.kernel.org/stable/c/6e3987ac310c74bb4dd6a2fa8e46702fe505fb2b https://git.kernel.org/stable/c/bed2eb964c70b780fb55925892a74f26cb590b25