Skip to content

libceph: validate OSD sparse-read extent maps (+KUnit)

Michael Bommarito ceph-devel lkml stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v11 patch 1 replySuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2libceph: validate OSD extent maps before cursor advancenet/ceph/osd_client.c+30 -00 replies
2/2libceph: add KUnit coverage for OSD sparse-read extent validationnet/ceph/Kconfig net/ceph/osd_client-kunit.c net/ceph/osd_client.c+162 -02 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchViacheslav Dubeyko
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] libceph: validate OSD sparse-read extent maps (+KUnit)

Patch 1 is the fix from v1 (unchanged), now carrying Viacheslav Dubeyko's Reviewed-by. Patch 2 adds the KUnit coverage he asked for.

osd_sparse_read() checks that the sparse-read data length matches the summed extent lengths but never checks that each OSD-supplied extent is monotonic and stays inside the original request range, so a malformed authenticated OSD reply can advance the message-data cursor past the request buffer and hit the BUG_ON(!*length) in ceph_msg_data_next(). Patch 1 rejects such maps before advancing the cursor.

The KUnit suite in patch 2 drives the real osd_sparse_read() state machine over a synthesized reply (no OSD, no network). Confirmed before/after on v7.2-rc3: without patch 1 the out-of-range case faults in ceph_msg_data_next() while the in-range control passes (1 pass, 1 fail); with patch 1 both pass.

v1: https://lore.kernel.org/ceph-devel/20260710022837.libceph-sparse-v1@bommarito/

Michael Bommarito (2):
libceph: validate OSD extent maps before cursor advance
libceph: add KUnit coverage for OSD sparse-read extent validation

 net/ceph/Kconfig            |  12 +++
 net/ceph/osd_client-kunit.c | 146 ++++++++++++++++++++++++++++++++++++
 net/ceph/osd_client.c       |  34 +++++++++
 3 files changed, 192 insertions(+)
 create mode 100644 net/ceph/osd_client-kunit.c
Signature · 1 line
2.53.0