mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/9] ceph: fix mdsmap and osdmap use-after-free in unlocked readers
@ 2026-11-11 16:18 Max Kellermann
  2026-11-11 16:18 ` [PATCH 1/9] ceph: fix mdsmap use-after-free in ceph_statfs() Max Kellermann
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Max Kellermann @ 2026-11-11 16:18 UTC (permalink / raw)
  To: xiubli, idryomov, amarkuze, ceph-devel, linux-kernel; +Cc: Max Kellermann

The MDS and OSD clients replace their maps and free the old ones
under a lock: mdsc->mutex for the mdsmap and osdc->lock for the
osdmap.  Several readers dereference these maps without that lock and
can therefore access freed memory if a new map arrives concurrently.
The worst is ceph_statfs(), which any user can reach and which loads
and dereferences a pointer from the old mdsmap.

Each patch takes the lock that protects the replacement around the
reads.  __ceph_setxattr() cannot take mdsc->mutex under i_ceph_lock,
so it uses a copy of m_max_xattr_size kept in the mds client.

The same problem in ceph_compare_options() was already fixed by
commit 19db525816db ("libceph: use RCU to protect monmap in
ceph_compare_options()").

These bugs were found by code review and have not been reproduced.

Max Kellermann (9):
  ceph: fix mdsmap use-after-free in ceph_statfs()
  ceph: fix mdsmap use-after-free in debugfs mdsmap_show()
  ceph: fix mdsmap use-after-free in __ceph_setxattr()
  ceph: fix mdsmap use-after-free in send_renew_caps() and
    renewed_caps()
  ceph: fix mdsmap use-after-free in mds_peer_reset()
  ceph: fix mdsmap use-after-free in ceph_get_tree() error path
  ceph: fix osdmap use-after-free in ceph_sync_setxattr()
  libceph: fix osdmap use-after-free in ceph_wait_for_latest_osdmap()
  rbd: fix osdmap use-after-free in pool lookups

 drivers/block/rbd.c    | 13 +++++++++++--
 fs/ceph/debugfs.c      | 12 ++++++++++--
 fs/ceph/mds_client.c   | 18 ++++++++++++++++--
 fs/ceph/mds_client.h   |  7 +++++++
 fs/ceph/super.c        | 19 ++++++++++++++-----
 fs/ceph/xattr.c        | 13 +++++++++----
 net/ceph/ceph_common.c |  8 +++++++-
 7 files changed, 74 insertions(+), 16 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-11-11 16:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 16:18 [PATCH 0/9] ceph: fix mdsmap and osdmap use-after-free in unlocked readers Max Kellermann
2026-11-11 16:18 ` [PATCH 1/9] ceph: fix mdsmap use-after-free in ceph_statfs() Max Kellermann
2026-11-11 16:18 ` [PATCH 2/9] ceph: fix mdsmap use-after-free in debugfs mdsmap_show() Max Kellermann
2026-11-11 16:18 ` [PATCH 3/9] ceph: fix mdsmap use-after-free in __ceph_setxattr() Max Kellermann
2026-11-11 16:18 ` [PATCH 4/9] ceph: fix mdsmap use-after-free in send_renew_caps() and renewed_caps() Max Kellermann
2026-11-11 16:18 ` [PATCH 5/9] ceph: fix mdsmap use-after-free in mds_peer_reset() Max Kellermann
2026-11-11 16:18 ` [PATCH 6/9] ceph: fix mdsmap use-after-free in ceph_get_tree() error path Max Kellermann
2026-11-11 16:18 ` [PATCH 7/9] ceph: fix osdmap use-after-free in ceph_sync_setxattr() Max Kellermann
2026-11-11 16:18 ` [PATCH 8/9] libceph: fix osdmap use-after-free in ceph_wait_for_latest_osdmap() Max Kellermann
2026-11-11 16:18 ` [PATCH 9/9] rbd: fix osdmap use-after-free in pool lookups Max Kellermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®