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 6D07915A4B3 for ; Fri, 12 Jul 2024 12:21:35 +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=1720786895; cv=none; b=ByxEMc7P/t7CuIOMwOn7Nq6y8m8TkjGQHfED1mKjG19pbqCov68+OswsCz6DbXPQt8y0cxq8sUeovOjGXr/7Cr/omAaAy2HQviE0Hdxvyd7Hzc5cNu8NCfDjHzlo4gC5ZqTy41WpmW2x3nE93ND7YSNme61TKT52nSHvruXL6Po= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720786895; c=relaxed/simple; bh=w2NyjLPpnSKcSEeYi1jl+7jUMl8iaMsKy5Z1BC4OCRs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hTsmLKQ+Cwk3kZDeyfAIxnBjPqLWrkU10e9/KRpEnxYSeGEDS1eEDPV0yKxo01tgy6ZPir+mGv8bjVzBT/7En8AFLN395mmfEd2vt1XEL7qRLjabGyQwG+u2saDpn6vWbVm1co2QqOFmnYjSDLRFivJ+C7Aw7vLQHwseRmFxzfI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=h2BaYL7j; 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="h2BaYL7j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9304AC32782; Fri, 12 Jul 2024 12:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720786895; bh=w2NyjLPpnSKcSEeYi1jl+7jUMl8iaMsKy5Z1BC4OCRs=; h=From:To:Cc:Subject:Date:Reply-to:From; b=h2BaYL7jl027DJ/YFINb9jdP7NZfyXaxI8h3uJo28yKqxfQ7KQwI+DYJldfttA+qM sYzLonBsKJwTYyxRwL7UXEtqIM6XdHdNzctXH4WVk+eTztijjYSRSDqRDzdtoZlcKc xK+hpdFUpvZaw3IfeQ69A21xdt5Ru0wvUotUu9qU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-39508: io_uring/io-wq: Use set_bit() and test_bit() at worker->flags Date: Fri, 12 Jul 2024 14:21:14 +0200 Message-ID: <2024071206-CVE-2024-39508-20c3@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=3094; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=w2NyjLPpnSKcSEeYi1jl+7jUMl8iaMsKy5Z1BC4OCRs=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkT5TddyY37NuVOkxaH8MOmbXvW/r01RWsmw+KQTdE9v x3kLatTO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAirQ0M8xMyAsvMfi7UNXv4 52CHopRbuaRqMsOCVR8MmGtuHRFwLY33Oir5QzR01hQdAA== 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: io_uring/io-wq: Use set_bit() and test_bit() at worker->flags Utilize set_bit() and test_bit() on worker->flags within io_uring/io-wq to address potential data races. The structure io_worker->flags may be accessed through various data paths, leading to concurrency issues. When KCSAN is enabled, it reveals data races occurring in io_worker_handle_work and io_wq_activate_free_worker functions. BUG: KCSAN: data-race in io_worker_handle_work / io_wq_activate_free_worker write to 0xffff8885c4246404 of 4 bytes by task 49071 on cpu 28: io_worker_handle_work (io_uring/io-wq.c:434 io_uring/io-wq.c:569) io_wq_worker (io_uring/io-wq.c:?) read to 0xffff8885c4246404 of 4 bytes by task 49024 on cpu 5: io_wq_activate_free_worker (io_uring/io-wq.c:? io_uring/io-wq.c:285) io_wq_enqueue (io_uring/io-wq.c:947) io_queue_iowq (io_uring/io_uring.c:524) io_req_task_submit (io_uring/io_uring.c:1511) io_handle_tw_list (io_uring/io_uring.c:1198) Line numbers against commit 18daea77cca6 ("Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm"). These races involve writes and reads to the same memory location by different tasks running on different CPUs. To mitigate this, refactor the code to use atomic operations such as set_bit(), test_bit(), and clear_bit() instead of basic "and" and "or" operations. This ensures thread-safe manipulation of worker flags. Also, move `create_index` to avoid holes in the structure. The Linux kernel CVE team has assigned CVE-2024-39508 to this issue. Affected and fixed versions =========================== Fixed in 6.6.35 with commit ab702c3483db Fixed in 6.9.6 with commit 1cbb0affb154 Fixed in 6.10-rc1 with commit 8a565304927f 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-39508 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: io_uring/io-wq.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/ab702c3483db9046bab9f40306f1a28b22dbbdc0 https://git.kernel.org/stable/c/1cbb0affb15470a9621267fe0a8568007553a4bf https://git.kernel.org/stable/c/8a565304927fbd28c9f028c492b5c1714002cbab