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 404A019E7F3 for ; Mon, 11 Nov 2024 13:58:27 +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=1731333508; cv=none; b=t9KKn/LYBy4hAKTT/CNxsSNiK8MWoGcVBPbyMa3zHZKMawBEvZYMLXf96iQQXzxojzBNZgLGZ7NvP5NZYBK/1SaywFjawkzEvUnkMRwwdEhzSlpBw7IEGL6xvfs9g2dYVlFPCDhkKoHVwMnOGpHzn6J6ux/CpXOHdJqIuuVfcwk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731333508; c=relaxed/simple; bh=WyizO5Dma+UeliQP8uzFplzr0UbohETQFnBWzEwUYqA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Bkp8/HFG4lzsC0C9gXSGxrp9aYxYzwKwGcFdFKtFyU3C8dZPOJqfCkR07RDAydAlapFjmTlf1DJCCalFqM+YJ3OsoO1cJEwm6f9+fpSp2YEMfz3JGE+YetKlZUdLwWMC6pwKrkQ9PUWOSxtwQ4wP3otT9U9Iw3ITqLqhlYEsvmc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yjkhczHJ; 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="yjkhczHJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55F3FC4CECF; Mon, 11 Nov 2024 13:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1731333507; bh=WyizO5Dma+UeliQP8uzFplzr0UbohETQFnBWzEwUYqA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=yjkhczHJGMmUCxG9nrh9dT8dyBXtVeI9p6B4am/eKozjW3Piwu+gN88g1z1oV2Mtf veKdT6oT5Ko8sV0GsEOdUuETG1DsZME8Ah8fOcA4a1MpRfazmxEODTFZT0TakGqQrg zD5lQIitja3BCTYuqcmprxxrXI5Of/FewbPFOYyE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-50263: fork: only invoke khugepaged, ksm hooks if no error Date: Mon, 11 Nov 2024 14:58:23 +0100 Message-ID: <2024111122-CVE-2024-50263-5c65@gregkh> X-Mailer: git-send-email 2.47.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=2812; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=WyizO5Dma+UeliQP8uzFplzr0UbohETQFnBWzEwUYqA=; b=owGbwMvMwCRo6H6F97bub03G02pJDOlGvHWPOtiaFlT+ES9mkOw0jZp7MMpfwiiw1KrmvUkdp +7LGImOWBYGQSYGWTFFli/beI7urzik6GVoexpmDisTyBAGLk4BmEhvJ8NsdpOqi5y/pm95xGn0 xkjWTGNyo9wjhgUnfwbsda2XZn/xLNb3x6nUW8s852kAAA== 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: only invoke khugepaged, ksm hooks if no error There is no reason to invoke these hooks early against an mm that is in an incomplete state. The change in commit d24062914837 ("fork: use __mt_dup() to duplicate maple tree in dup_mmap()") makes this more pertinent as we may be in a state where entries in the maple tree are not yet consistent. Their placement early in dup_mmap() only appears to have been meaningful for early error checking, and since functionally it'd require a very small allocation to fail (in practice 'too small to fail') that'd only occur in the most dire circumstances, meaning the fork would fail or be OOM'd in any case. Since both khugepaged and KSM tracking are there to provide optimisations to memory performance rather than critical functionality, it doesn't really matter all that much if, under such dire memory pressure, we fail to register an mm with these. As a result, we follow the example of commit d2081b2bf819 ("mm: khugepaged: make khugepaged_enter() void function") and make ksm_fork() a void function also. We only expose the mm to these functions once we are done with them and only if no error occurred in the fork operation. The Linux kernel CVE team has assigned CVE-2024-50263 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit d24062914837 and fixed in 6.11.7 with commit 3b85aa0da8cd Issue introduced in 6.8 with commit d24062914837 and fixed in 6.12-rc6 with commit 985da552a98e 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-50263 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: include/linux/ksm.h 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/3b85aa0da8cd01173b9afd1f70080fbb9576c4b0 https://git.kernel.org/stable/c/985da552a98e27096444508ce5d853244019111f