ceph: fix mdsmap and osdmap use-after-free in unlocked readers
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest9 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | ceph: fix mdsmap use-after-free in ceph_statfs()fs/ | +8 | 0 replies | |
| 2/9 | ceph: fix mdsmap use-after-free in debugfs mdsmap_show()fs/ | +10 | 0 replies | |
| 3/9 | ceph: fix mdsmap use-after-free in __ceph_setxattr()fs/ fs/ fs/ | +14 | 0 replies | |
| 4/9 | ceph: fix mdsmap use-after-free in send_renew_caps() and renewed_caps()fs/ | +8 | 0 replies | |
| 5/9 | ceph: fix mdsmap use-after-free in mds_peer_reset()fs/ | +7 | 0 replies | |
| 6/9 | ceph: fix mdsmap use-after-free in ceph_get_tree() error pathfs/ | +6 | 0 replies | |
| 7/9 | ceph: fix osdmap use-after-free in ceph_sync_setxattr()fs/ | +3 | 0 replies | |
| 8/9 | libceph: fix osdmap use-after-free in ceph_wait_for_latest_osdmap()net/ | +7 | 0 replies | |
| 9/9 | rbd: fix osdmap use-after-free in pool lookupsdrivers/ | +11 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/9] ceph: fix mdsmap and osdmap use-after-free in unlocked readers
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(-)
Signature · 1 line
2.53.0