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 D581B20B21C for ; Wed, 26 Feb 2025 02:01:39 +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=1740535299; cv=none; b=uy87CV1gkBnUpXK1iweEmvRn8WcfyEqdG3P3Qzd7RrzLfUspe+lV0gRL+ecBG7jF+MBze9BiDU+e7TVdqDV4s907+MMfv4hKRDFuEOMr55JoMpfxupCMyzpOqC6rm9WRk8qUS8vTjuA2hmheW/+o+ytC9uFTql9KKuFyQy48iYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740535299; c=relaxed/simple; bh=iHqqVHslVsBxH8DucrNwTsW6Vf4T/gj01JZ0bva5Duk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AaUhaob3DJvC7Ygb4AuDEiri3MUHS+PdEwNH1ryN8cZRD6+AnF3uppu0Ov2aAQsnf4RMz7Z1vglxx5useXnzD7r8QYah9LvrEAuAs07QoVFntxSMG3tZ9APqwCigUngufj+G5AQiCT7t9UHuiqvNIp1qkZHjNwRWWIIdKsqbzas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RIdIsNKj; 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="RIdIsNKj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9E31C4CEDD; Wed, 26 Feb 2025 02:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740535299; bh=iHqqVHslVsBxH8DucrNwTsW6Vf4T/gj01JZ0bva5Duk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=RIdIsNKjGgvmK75vxRHOCLTM3uSJS15721XFi3XVbj9F7n29VhfcADhhsCR9L7MiL jxxb3C3swOsLOj/d7LKjIUm7nZafHBZBwSr3+KTnSjBnzwMUnVWo/UEq5djM4wxfIY 7DR1U1DX9unRl0YBk+dRQ89jv5d71nlAIHOugDDc= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49296: ceph: fix possible deadlock when holding Fwb to get inline_data Date: Wed, 26 Feb 2025 03:00:28 +0100 Message-ID: <2025022625-CVE-2022-49296-f8f1@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=3564; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=iHqqVHslVsBxH8DucrNwTsW6Vf4T/gj01JZ0bva5Duk=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7Sncm6s+a5nfhS4bhLK5j6antBldCFCfflSpNPS+6/ dnrpuZTHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRKkWGObz/7Use5mwKyOe9 +1Coyrp34hVjAYb55V90nJf9ylsj+1Dt4vWaljnbuNT+AwA= 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: ceph: fix possible deadlock when holding Fwb to get inline_data 1, mount with wsync. 2, create a file with O_RDWR, and the request was sent to mds.0: ceph_atomic_open()--> ceph_mdsc_do_request(openc) finish_open(file, dentry, ceph_open)--> ceph_open()--> ceph_init_file()--> ceph_init_file_info()--> ceph_uninline_data()--> { ... if (inline_version == 1 || /* initial version, no data */ inline_version == CEPH_INLINE_NONE) goto out_unlock; ... } The inline_version will be 1, which is the initial version for the new create file. And here the ci->i_inline_version will keep with 1, it's buggy. 3, buffer write to the file immediately: ceph_write_iter()--> ceph_get_caps(file, need=Fw, want=Fb, ...); generic_perform_write()--> a_ops->write_begin()--> ceph_write_begin()--> netfs_write_begin()--> netfs_begin_read()--> netfs_rreq_submit_slice()--> netfs_read_from_server()--> rreq->netfs_ops->issue_read()--> ceph_netfs_issue_read()--> { ... if (ci->i_inline_version != CEPH_INLINE_NONE && ceph_netfs_issue_op_inline(subreq)) return; ... } ceph_put_cap_refs(ci, Fwb); The ceph_netfs_issue_op_inline() will send a getattr(Fsr) request to mds.1. 4, then the mds.1 will request the rd lock for CInode::filelock from the auth mds.0, the mds.0 will do the CInode::filelock state transation from excl --> sync, but it need to revoke the Fxwb caps back from the clients. While the kernel client has aleady held the Fwb caps and waiting for the getattr(Fsr). It's deadlock! URL: https://tracker.ceph.com/issues/55377 The Linux kernel CVE team has assigned CVE-2022-49296 to this issue. Affected and fixed versions =========================== Fixed in 5.18.4 with commit 292b7a7275ce535a1abfa4dd0b2e586162aaae1e Fixed in 5.19 with commit 825978fd6a0defc3c29d8a38b6cea76a0938d21e 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-2022-49296 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: fs/ceph/addr.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/292b7a7275ce535a1abfa4dd0b2e586162aaae1e https://git.kernel.org/stable/c/825978fd6a0defc3c29d8a38b6cea76a0938d21e