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 8292B17C77 for ; Thu, 27 Feb 2025 20:01:19 +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=1740686479; cv=none; b=aAVmNynjwgyhk9c2ufv6KV9LT6t3FkiOkAr7CcNiZE9OArETybM2eKE3RlPzJZ8gZlrBpwr77ssrpcYUvAaO1Ni+JM5+w10DHffET8tKjwl9vJa5F9j4X/+HonAJydMTBjUvLwMVmqKPdwnhi0VyAZhUAI5gPZh30AyAicP0fxQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740686479; c=relaxed/simple; bh=fSBhk/oxDQ6rocKk9Kl2bLv9LA1ICbZCzyplM3z1+a4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sQUh/hzGlIeO6D9KU37pAuUICTIqxHeIa4DCfBP6OL4wMqmW1PkATf0GwhiZ9dFV8VJf9csBJePKbytXVQ87FEzgr1t6P8KLY9QAwdgoMeXYDZj4vz3RKiqShL/u/iN95qPTEtt+Vej1J9QJV8kg38bGINAFlz0rlSD1lKGXeiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fX5Tyh36; 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="fX5Tyh36" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57D56C4CEE4; Thu, 27 Feb 2025 20:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740686479; bh=fSBhk/oxDQ6rocKk9Kl2bLv9LA1ICbZCzyplM3z1+a4=; h=From:To:Cc:Subject:Date:Reply-to:From; b=fX5Tyh36FkEKXLERvZ5DrFKrZR/h6evyqE0QC6SwQfdAxirv+D8Wn5zngEkJzur9f JxDIVYZSKUL9OtEtoOp3sfA+tLJPW7d+brnCPbGMTZQmYOa93o7/qeJW1yTtyJx5Hb 7qFPTrL18wqEBeMLkKk0uIWl0015CYI1wwTPWH7E= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-58042: rhashtable: Fix potential deadlock by moving schedule_work outside lock Date: Thu, 27 Feb 2025 11:59:51 -0800 Message-ID: <2025022751-CVE-2024-58042-c5ba@gregkh> X-Mailer: git-send-email 2.48.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=2914; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=fSBhk/oxDQ6rocKk9Kl2bLv9LA1ICbZCzyplM3z1+a4=; b=owGbwMvMwCRo6H6F97bub03G02pJDOkHjpjXPtWZ4if9/VHqiqo/F9fFx191/9Pg1zTD4Irwo Y6tn9WOdcSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEmM8wLOjt42hmMM0wii92 /Fgsdocp22pbJMP8QP1n+8w/CbXN5elakGilPqnl7dliAA== 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: rhashtable: Fix potential deadlock by moving schedule_work outside lock Move the hash table growth check and work scheduling outside the rht lock to prevent a possible circular locking dependency. The original implementation could trigger a lockdep warning due to a potential deadlock scenario involving nested locks between rhashtable bucket, rq lock, and dsq lock. By relocating the growth check and work scheduling after releasing the rth lock, we break this potential deadlock chain. This change expands the flexibility of rhashtable by removing restrictive locking that previously limited its use in scheduler and workqueue contexts. Import to say that this calls rht_grow_above_75(), which reads from struct rhashtable without holding the lock, if this is a problem, we can move the check to the lock, and schedule the workqueue after the lock. Modified so that atomic_inc is also moved outside of the bucket lock along with the growth above 75% check. The Linux kernel CVE team has assigned CVE-2024-58042 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12 with commit f0e1a0643a59bf1f922fa209cec86a170b784f3f and fixed in 6.12.13 with commit eb2e58484b838fb4e777ee9721bb9e20e6ca971d Issue introduced in 6.12 with commit f0e1a0643a59bf1f922fa209cec86a170b784f3f and fixed in 6.13.2 with commit ced8ce3c83a7150c5f5d371a8c332d7bc7f9b66d Issue introduced in 6.12 with commit f0e1a0643a59bf1f922fa209cec86a170b784f3f and fixed in 6.14-rc1 with commit e1d3422c95f003eba241c176adfe593c33e8a8f6 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-58042 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: lib/rhashtable.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/eb2e58484b838fb4e777ee9721bb9e20e6ca971d https://git.kernel.org/stable/c/ced8ce3c83a7150c5f5d371a8c332d7bc7f9b66d https://git.kernel.org/stable/c/e1d3422c95f003eba241c176adfe593c33e8a8f6