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 EF13D1311A3 for ; Fri, 5 Jul 2024 06:55:36 +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=1720162537; cv=none; b=MLIZWKiUS4k0n2EFX01ZNPJ8S5So/2kxHCTSu8zALkOpB3N0hXYlWgyiONwIkLEQsOmCLnDlb/G9PbpByxbVIbuaQVnJ3HqleTgL8sPCBgw1ONkeuXHhNMy9qh8c7LlthxYB56LMmQBnH7M2HAYADsjzhxpRBDjrHg4/RKfFjHs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720162537; c=relaxed/simple; bh=Wamfmu9kGRz2J46LOGtOsAOJ11d7ncacAvMiQrC3GoA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JUzqco5x/R6InTYA+xGeSm7CigMD36FdMY5ev+HtOPINeZqAoyrZxZs+Fnp2mwh8FDdPygQLNGhDTRs0uvqGXswh3Vwr/JRe6iRqkbYzK2dJzZLXlN9RcbwzxUB+US0Y/2kwHgBCv46OG60y8YJOFn8UsR0mcONPm60LH4JODws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mYpfk6Rf; 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="mYpfk6Rf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2736BC32786; Fri, 5 Jul 2024 06:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720162536; bh=Wamfmu9kGRz2J46LOGtOsAOJ11d7ncacAvMiQrC3GoA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=mYpfk6RfBKIR8k2DZePE8nq/5dNjoukyQEtOPllOr55I/AUv6v4DmC3rXsHiLwONQ 9hUwk5tdNgSxiEPqEkYB//+A76XNllFHtjjYquqnA3E3WqC2OJkYFBq67C2144tn8P JiUleNhTTUgT3/2Va0FkpwpQwIo1sH5Uyw0GTq+g= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-39477: mm/hugetlb: do not call vma_add_reservation upon ENOMEM Date: Fri, 5 Jul 2024 08:55:21 +0200 Message-ID: <2024070519-CVE-2024-39477-5c3f@gregkh> X-Mailer: git-send-email 2.45.2 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=2354; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Wamfmu9kGRz2J46LOGtOsAOJ11d7ncacAvMiQrC3GoA=; b=owGbwMvMwCRo6H6F97bub03G02pJDGntM64HSydWvhPx1pvMkL1coFLqxalPgTwrZD289y5uO LbyfvPsjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhI6jaGBfuqd3dcUo1JneZd a/tT3dyGl9dzJcMc/n03GR406L5cmHXLsPZWVyBT99Q8AA== 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: mm/hugetlb: do not call vma_add_reservation upon ENOMEM sysbot reported a splat [1] on __unmap_hugepage_range(). This is because vma_needs_reservation() can return -ENOMEM if allocate_file_region_entries() fails to allocate the file_region struct for the reservation. Check for that and do not call vma_add_reservation() if that is the case, otherwise region_abort() and region_del() will see that we do not have any file_regions. If we detect that vma_needs_reservation() returned -ENOMEM, we clear the hugetlb_restore_reserve flag as if this reservation was still consumed, so free_huge_folio() will not increment the resv count. [1] https://lore.kernel.org/linux-mm/0000000000004096100617c58d54@google.com/T/#ma5983bc1ab18a54910da83416b3f89f3c7ee43aa The Linux kernel CVE team has assigned CVE-2024-39477 to this issue. Affected and fixed versions =========================== Issue introduced in 6.9 with commit df7a6d1f6405 and fixed in 6.9.5 with commit aa998f9dcb34 Issue introduced in 6.9 with commit df7a6d1f6405 and fixed in 6.10-rc3 with commit 8daf9c702ee7 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-39477 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: mm/hugetlb.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/aa998f9dcb34c28448f86e8f5490f20d5eb0eac7 https://git.kernel.org/stable/c/8daf9c702ee7f825f0de8600abff764acfedea13