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 716BD41214 for ; Fri, 17 May 2024 12:25:21 +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=1715948721; cv=none; b=WezSR1LudXutGVZYFWkCSTQaPJNmFEs+abQBOqB1sDI4CZS5FriiuUe2632LmIMqSdawmvJLO0xSxxldz0Yr+WJGPdsjinDcs6Ryak+PP6/AU3/eUzmUj2Ucd+ih+mgw0S/iq/Kj2O2yAoy9xorVfyp4o7ZPzcL4WzUMvxCjmmE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715948721; c=relaxed/simple; bh=ujDRcYZQA5nMlYsvR/FCd/YCiImdKmKjux5DSPb6HWA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tdWmp9QXqJMQQaW4RmoY6MTnjPq6HZRJkd6RH6LK8Ctey+EjzZQrwbDP8bG1GoiNJrJJjWT6osQmNy1EH+Qm8fJp0Hm+0hp2RvSHXXUa9RFIc2uvEB1cyusgBWyC7hd5eCn+KJmLRWmkSWUZfqRPaILrcCF2ajlxVnHjGpk3BYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1SztoCOI; 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="1SztoCOI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93DF8C2BD10; Fri, 17 May 2024 12:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1715948721; bh=ujDRcYZQA5nMlYsvR/FCd/YCiImdKmKjux5DSPb6HWA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=1SztoCOI49Q0+XAFbKs76DmT5hjfESa1f0RMAOMqyMNQf8KkLCJwMc7d7oe9bEWJY a0ItuiVWqaptlTn/SGsAUafSSoxipoVlcXkF13REK5Sa6xHhYEey1+OPChpxE1lhrs 8lhXE2W5ojRc7F5SyuXz2EzAt8E7QKrqC0GCEwTE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-35794: dm-raid: really frozen sync_thread during suspend Date: Fri, 17 May 2024 14:25:15 +0200 Message-ID: <2024051709-CVE-2024-35794-f42d@gregkh> X-Mailer: git-send-email 2.45.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=3534; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ujDRcYZQA5nMlYsvR/FCd/YCiImdKmKjux5DSPb6HWA=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnuPkvDbszTdtlRUHTqZMvFPZ93aQuUxsetmzFXIsZY8 aDUT0aOjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhI+HmGedY625vyvxzi1FJc fJl/ftHh5rjNixgWTD9nf3+JWVje5h03T53rLvQrdtw/HQA= 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: dm-raid: really frozen sync_thread during suspend 1) commit f52f5c71f3d4 ("md: fix stopping sync thread") remove MD_RECOVERY_FROZEN from __md_stop_writes() and doesn't realize that dm-raid relies on __md_stop_writes() to frozen sync_thread indirectly. Fix this problem by adding MD_RECOVERY_FROZEN in md_stop_writes(), and since stop_sync_thread() is only used for dm-raid in this case, also move stop_sync_thread() to md_stop_writes(). 2) The flag MD_RECOVERY_FROZEN doesn't mean that sync thread is frozen, it only prevent new sync_thread to start, and it can't stop the running sync thread; In order to frozen sync_thread, after seting the flag, stop_sync_thread() should be used. 3) The flag MD_RECOVERY_FROZEN doesn't mean that writes are stopped, use it as condition for md_stop_writes() in raid_postsuspend() doesn't look correct. Consider that reentrant stop_sync_thread() do nothing, always call md_stop_writes() in raid_postsuspend(). 4) raid_message can set/clear the flag MD_RECOVERY_FROZEN at anytime, and if MD_RECOVERY_FROZEN is cleared while the array is suspended, new sync_thread can start unexpected. Fix this by disallow raid_message() to change sync_thread status during suspend. Note that after commit f52f5c71f3d4 ("md: fix stopping sync thread"), the test shell/lvconvert-raid-reshape.sh start to hang in stop_sync_thread(), and with previous fixes, the test won't hang there anymore, however, the test will still fail and complain that ext4 is corrupted. And with this patch, the test won't hang due to stop_sync_thread() or fail due to ext4 is corrupted anymore. However, there is still a deadlock related to dm-raid456 that will be fixed in following patches. The Linux kernel CVE team has assigned CVE-2024-35794 to this issue. Affected and fixed versions =========================== Issue introduced in 4.8 with commit 9dbd1aa3a81c and fixed in 6.7.12 with commit af916cb66a80 Issue introduced in 4.8 with commit 9dbd1aa3a81c and fixed in 6.8.3 with commit eaa8fc9b0928 Issue introduced in 4.8 with commit 9dbd1aa3a81c and fixed in 6.9 with commit 16c4770c75b1 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-35794 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: drivers/md/dm-raid.c drivers/md/md.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/af916cb66a80597f3523bc85812e790bcdcfd62b https://git.kernel.org/stable/c/eaa8fc9b092837cf2c754bde1a15d784ce9a85ab https://git.kernel.org/stable/c/16c4770c75b1223998adbeb7286f9a15c65fba73