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 E3B13433D4 for ; Wed, 1 May 2024 05:35:47 +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=1714541748; cv=none; b=DawvPxNTkcgRpdFHFkN8+6tpxOwrtazkAziRNrVabGuTgltKOP5kjki7ztSaFh63b5rR8SbIRlO/7N4RSSeVVrW1yKZZHzutht/PStZnbcPbMq1mDeXs73nDkKNsglGoq8NWQTZEigCmLTSrkC1FJKQ+E5W/HLWi5iHZS7YoduI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714541748; c=relaxed/simple; bh=dNmA+ReQTv/wgM0A0AUjdiiWme78g+xDfHJzJPR9FOI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KrdCSKZ5LD3s6uftkN3jGBTC0EXLjgeDUd6Tv6lma7fq6FPfftRC9Iebf0h/42wQd9KpmNuFCQnAIUkUmrR92d/cBHa575kprqmq9hZbMzzqD9uTUP+J2hZErcJN7jKMQpNIxJh9Vg9CvGqxzz8k6m22h2xO1b/L9C4koAOv3qA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=W7OqQEvb; 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="W7OqQEvb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 195F3C113CC; Wed, 1 May 2024 05:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714541747; bh=dNmA+ReQTv/wgM0A0AUjdiiWme78g+xDfHJzJPR9FOI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=W7OqQEvbqXbXEOYS4hEtgai2oqcVA5HKeXFRIelJ82vqjW5dIgtRBgQQUMADaheRb X1nsiFfpIFAKP9u6B/VhcFwOEqg74kc2omk0uDpLClBicgtBXkCAmZY4m5PGcNd/v6 MxA9B8UcAAx+Nts6zkjfbFTeKGYgX+kL+NcGar28= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-27022: fork: defer linking file vma until vma is fully initialized Date: Wed, 1 May 2024 07:35:44 +0200 Message-ID: <2024050143-CVE-2024-27022-4325@gregkh> X-Mailer: git-send-email 2.44.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=2612; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=dNmA+ReQTv/wgM0A0AUjdiiWme78g+xDfHJzJPR9FOI=; b=owGbwMvMwCRo6H6F97bub03G02pJDGmGVzbsqOcReDOPQ1X8s45u/dfoCVFZHzaIL+mQYNU6a iK7QWRFRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEwk4ifDHB7XjXZvTgRp/Zec /T2U/8FBo9UZ/xgWTGxkZ/35dfUxySexJ703ZxQpProcDgA= 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: fork: defer linking file vma until vma is fully initialized Thorvald reported a WARNING [1]. And the root cause is below race: CPU 1 CPU 2 fork hugetlbfs_fallocate dup_mmap hugetlbfs_punch_hole i_mmap_lock_write(mapping); vma_interval_tree_insert_after -- Child vma is visible through i_mmap tree. i_mmap_unlock_write(mapping); hugetlb_dup_vma_private -- Clear vma_lock outside i_mmap_rwsem! i_mmap_lock_write(mapping); hugetlb_vmdelete_list vma_interval_tree_foreach hugetlb_vma_trylock_write -- Vma_lock is cleared. tmp->vm_ops->open -- Alloc new vma_lock outside i_mmap_rwsem! hugetlb_vma_unlock_write -- Vma_lock is assigned!!! i_mmap_unlock_write(mapping); hugetlb_dup_vma_private() and hugetlb_vm_op_open() are called outside i_mmap_rwsem lock while vma lock can be used in the same time. Fix this by deferring linking file vma until vma is fully initialized. Those vmas should be initialized first before they can be used. The Linux kernel CVE team has assigned CVE-2024-27022 to this issue. Affected and fixed versions =========================== Issue introduced in 6.1 with commit 8d9bfb260814 and fixed in 6.8.8 with commit abdb88dd272b Issue introduced in 6.1 with commit 8d9bfb260814 and fixed in 6.9-rc5 with commit 35e351780fa9 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-27022 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/fork.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/abdb88dd272bbeb93efe01d8e0b7b17e24af3a34 https://git.kernel.org/stable/c/35e351780fa9d8240dd6f7e4f245f9ea37e96c19