Re: [PATCH] ceph: bound num_split_inos and num_split_realms in ceph_handle_snap()

From: James Sawyer

Date: Thu Dec 03 2026 - 16:06:47 EST


Hi Michael,

Is a v2 of this still planned? I couldn't find one, and the bug is still in
mainline (checked 2026-12-01).

I reproduced both paths on a stock 7.0 kernel with a fake MDS:
- non-split (op UPDATE, num_split_inos = 0x80000000): a page fault in
ceph_update_snap_trace+0xc4, with the cursor exactly 0x400000000 below
the message;
- split (num_split_inos = N, num_split_realms = -N): the offsets cancel,
the sizeof(*ri) check passes, and the split loop reads split_inos[]
forward until it faults (ceph_handle_snap+0x21d).

The single check Slava suggested, done before either branch moves p, fixes
both. In my version that is
ceph_decode_need(&p, e, size_add(array_size(num_split_inos, sizeof(u64)),
array_size(num_split_realms, sizeof(u64))), bad);
with both counts as u32. Both variants then end in "corrupt snap message
from mds0".

If you'd rather not continue it, I'm happy to send a v2 that credits you.

Disclosure: this was found and tested with an AI assistant (Claude),
following Documentation/process/coding-assistants.rst. The test harnesses
and measurements are from runs on my own lab machines, which I checked.

James Sawyer