From mboxrd@z Thu Jan 1 00:00:00 1970 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 415A615E5C2 for ; Thu, 27 Feb 2025 02:13: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=1740622415; cv=none; b=UiFD/PrDaUwLs1emVLKf34PHktwh2s+oIuLzYZ8nBbA78f0yGcTnwYqm+kD0oNTzLPCVGUxaOPDVKvCxVcmh7Bryp3n5k4FKEa/62QEpB6w3vKEn36dzWZ+32AblYN2WOJKOna10rgPDl046HGTFTLGirlapnsvU/qvZV3l7d68= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740622415; c=relaxed/simple; bh=SOuyPElZZ6Zz8WInYZTaY/BwC0y0nIjGah6nEIymAsU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=P2pJlsCmFndyLIYF/4XwEmlW3O0fD8klx8xS7zmCWSwACXWGk6G1mLgmbcEmqQItMSCBKJ0SiL2pQsJ0jeDucWIt6YqS54Vro//dY812Y+CbORbNH+yfCFSW+5Bfsp/hN62c9ye2dKWBxHvsAG2j6l3sifqaeC/QZ1SE/wJWOm0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tgiF1Ri8; 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="tgiF1Ri8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02BAAC4CED6; Thu, 27 Feb 2025 02:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740622415; bh=SOuyPElZZ6Zz8WInYZTaY/BwC0y0nIjGah6nEIymAsU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=tgiF1Ri8AJtrhAy4GgRgmeBYlHcx1XNHpMMYFY+Sa/yaPRoMZRkRflcznAxh7l5tR mw5D7SvMkOtAlKC+9tKn4pmpCS1O/kONzJbTMHHglqJNZJ+M08eeaSNPhYD95Q3gxR ZgDmOBkiDvBRE6pAGOcm652bTr+FpZsRGz5HCnwc= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21737: ceph: fix memory leak in ceph_mds_auth_match() Date: Wed, 26 Feb 2025 18:11:19 -0800 Message-ID: <2025022659-CVE-2025-21737-db6e@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=4347; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=SOuyPElZZ6Zz8WInYZTaY/BwC0y0nIjGah6nEIymAsU=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7T25+1SNxK/r3v6uHY/J73Y9+kFzdklIxq6PgQ1dh4 fvpMRIPO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiU+oYFrTfUa1YvehIjPIt oRen5XYsTkh2VmKY78487b/OSVtT08NV6/WP3bxxz3WOBAA= 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 memory leak in ceph_mds_auth_match() We now free the temporary target path substring allocation on every possible branch, instead of omitting the default branch. In some cases, a memory leak occured, which could rapidly crash the system (depending on how many file accesses were attempted). This was detected in production because it caused a continuous memory growth, eventually triggering kernel OOM and completely hard-locking the kernel. Relevant kmemleak stacktrace: unreferenced object 0xffff888131e69900 (size 128): comm "git", pid 66104, jiffies 4295435999 hex dump (first 32 bytes): 76 6f 6c 75 6d 65 73 2f 63 6f 6e 74 61 69 6e 65 volumes/containe 72 73 2f 67 69 74 65 61 2f 67 69 74 65 61 2f 67 rs/gitea/gitea/g backtrace (crc 2f3bb450): [] __kmalloc_noprof+0x359/0x510 [] ceph_mds_check_access+0x5bf/0x14e0 [ceph] [] ceph_open+0x312/0xd80 [ceph] [] do_dentry_open+0x456/0x1120 [] vfs_open+0x79/0x360 [] path_openat+0x1de5/0x4390 [] do_filp_open+0x19c/0x3c0 [] do_sys_openat2+0x141/0x180 [] __x64_sys_open+0xe5/0x1a0 [] do_syscall_64+0xb7/0x210 [] entry_SYSCALL_64_after_hwframe+0x77/0x7f It can be triggered by mouting a subdirectory of a CephFS filesystem, and then trying to access files on this subdirectory with an auth token using a path-scoped capability: $ ceph auth get client.services [client.services] key = REDACTED caps mds = "allow rw fsname=cephfs path=/volumes/" caps mon = "allow r fsname=cephfs" caps osd = "allow rw tag cephfs data=cephfs" $ cat /proc/self/mounts services@[REDACTED].cephfs=/volumes/containers /ceph/containers ceph rw,noatime,name=services,secret=,ms_mode=prefer-crc,mount_timeout=300,acl,mon_addr=[REDACTED]:3300,recover_session=clean 0 0 $ seq 1 1000000 | xargs -P32 --replace={} touch /ceph/containers/file-{} && \ seq 1 1000000 | xargs -P32 --replace={} cat /ceph/containers/file-{} [ idryomov: combine if statements, rename rc to path_matched and make it a bool, formatting ] The Linux kernel CVE team has assigned CVE-2025-21737 to this issue. Affected and fixed versions =========================== Issue introduced in 6.10 with commit 596afb0b8933ba6ed7227adcc538db26feb25c74 and fixed in 6.12.14 with commit 146109fe936ac07f8f60cd6267543688985b96bc Issue introduced in 6.10 with commit 596afb0b8933ba6ed7227adcc538db26feb25c74 and fixed in 6.13.3 with commit 2b6086c5efe5c7bd6e0eb440d96c26ca0d20d9d7 Issue introduced in 6.10 with commit 596afb0b8933ba6ed7227adcc538db26feb25c74 and fixed in 6.14-rc1 with commit 3b7d93db450e9d8ead80d75e2a303248f1528c35 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-2025-21737 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/mds_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/146109fe936ac07f8f60cd6267543688985b96bc https://git.kernel.org/stable/c/2b6086c5efe5c7bd6e0eb440d96c26ca0d20d9d7 https://git.kernel.org/stable/c/3b7d93db450e9d8ead80d75e2a303248f1528c35