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 ACF8878C92 for ; Wed, 7 Aug 2024 15:26:48 +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=1723044408; cv=none; b=ZWdi/oOGWB38nJPjPiw5AHqlJxZ+9i2H5RC7dPmf7eb/8t+88I0PhgLkDRa2IF7RexnZ+qW5ts5agFXCMqf2LPXNekI2NosFQdq2jMP7cu/i1hYDz/lYpFS4HgMd+LEN+WV98B5XXyrooN/XXlTRrnxJTJ+Y4Qd4YNzOhKc+Pqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723044408; c=relaxed/simple; bh=cGdswHDjKCwAqCUxAAOkbTD3lkD0366y3B5SVupEJqc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ch32827zNGkZjyUBJ24MCawn1NUQqhHgwRf0x0Ru5kSoodNy4hORDrNnYCX5fX5x7SP614i+tDAH1wzwxg+SKPF3gxrJFutomPQ+Auyfz5sYh+b/gOhq5nTJluMhsj0smWVJhlTRbsVZXzm+AuUl6Q9IF570x0ZWgAmLReqeuI8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YXhs903O; 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="YXhs903O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB0BCC32781; Wed, 7 Aug 2024 15:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723044408; bh=cGdswHDjKCwAqCUxAAOkbTD3lkD0366y3B5SVupEJqc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=YXhs903OBE4MuZjXgkGyPxgFPviH/x4NNLe8aKQ3mECw9O9AdRho1vhy+8LL0LmWM 6rq5pFkpwe4MkXj77SKRWMY8s9+m4Ee6TDfs7n5oBPwXFg6QdTIRFwIjbu2VgNXvYW +L8RsVG16lPFevfjoLOTj5xDwAadvmai1EQyjQvE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-42232: libceph: fix race between delayed_work() and ceph_monc_stop() Date: Wed, 7 Aug 2024 17:14:38 +0200 Message-ID: <2024080737-CVE-2024-42232-8ab2@gregkh> X-Mailer: git-send-email 2.46.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=3257; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=cGdswHDjKCwAqCUxAAOkbTD3lkD0366y3B5SVupEJqc=; b=owGbwMvMwCRo6H6F97bub03G02pJDGmb+2Mf875jLLn0Uq9mSp7i/ePtQQ+/NnfovnmxbNPNi oOBIutYOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAircsYFnRxP9eMsBUJXTc1 zK4n0JBx7eKNWxlmMec/qNz+XWDja46UrNTfr75G9y1uBgA= 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: libceph: fix race between delayed_work() and ceph_monc_stop() The way the delayed work is handled in ceph_monc_stop() is prone to races with mon_fault() and possibly also finish_hunting(). Both of these can requeue the delayed work which wouldn't be canceled by any of the following code in case that happens after cancel_delayed_work_sync() runs -- __close_session() doesn't mess with the delayed work in order to avoid interfering with the hunting interval logic. This part was missed in commit b5d91704f53e ("libceph: behave in mon_fault() if cur_mon < 0") and use-after-free can still ensue on monc and objects that hang off of it, with monc->auth and monc->monmap being particularly susceptible to quickly being reused. To fix this: - clear monc->cur_mon and monc->hunting as part of closing the session in ceph_monc_stop() - bail from delayed_work() if monc->cur_mon is cleared, similar to how it's done in mon_fault() and finish_hunting() (based on monc->hunting) - call cancel_delayed_work_sync() after the session is closed The Linux kernel CVE team has assigned CVE-2024-42232 to this issue. Affected and fixed versions =========================== Fixed in 4.19.318 with commit 1177afeca833 Fixed in 5.4.280 with commit 63e5d035e3a7 Fixed in 5.10.222 with commit 34b76d1922e4 Fixed in 5.15.163 with commit 20cf67dcb7db Fixed in 6.1.100 with commit 2d33654d40a0 Fixed in 6.6.41 with commit 9525af1f58f6 Fixed in 6.9.10 with commit 33d38c5da17f Fixed in 6.10 with commit 69c7b2fe4c9c 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-42232 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: net/ceph/mon_client.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/1177afeca833174ba83504688eec898c6214f4bf https://git.kernel.org/stable/c/63e5d035e3a7ab7412a008f202633c5e6a0a28ea https://git.kernel.org/stable/c/34b76d1922e41da1fa73d43b764cddd82ac9733c https://git.kernel.org/stable/c/20cf67dcb7db842f941eff1af6ee5e9dc41796d7 https://git.kernel.org/stable/c/2d33654d40a05afd91ab24c9a73ab512a0670a9a https://git.kernel.org/stable/c/9525af1f58f67df387768770fcf6d6a8f23aee3d https://git.kernel.org/stable/c/33d38c5da17f8db2d80e811b7829d2822c10625e https://git.kernel.org/stable/c/69c7b2fe4c9cc1d3b1186d1c5606627ecf0de883