CVE-2026-99304: ceph: fix integer overflow in the snap trace bounds check
In the Linux kernel, the following vulnerability has been resolved:
ceph: fix integer overflow in the snap trace bounds check
cephupdatesnaptrace() bounds the two encoded snapid arrays that follow a struct cephmdssnaprealm with sizeof(u64) (numsnaps + numpriorparentsnaps). Both counts come straight off the wire as le32, so the addition is evaluated in unsigned int and wraps before sizeof(u64) promotes it to sizet: an MDS sending numsnaps = 1 and numpriorparentsnaps = 0xffffffff makes the sum zero and the check degenerates to cephdecodeneed(&p, e, 0, bad), which always passes. duparray() then reads numsnaps 8 bytes past the end of the message front, which cephmsgnew2() allocates at exactly frontlen bytes. An unsolicited CEPHMSGCLIENTSNAP reaches this from a malicious or compromised MDS with no client-side action, as do the snaptraces carried in an MDS reply and in a cap import.
Compute the length with sizeadd()/sizemul() so it saturates at SIZEMAX instead of wrapping, in the style fs/ceph/mdsmap.c already uses for numexporttargets.
BUG: KASAN: slab-out-of-bounds in duparray (include/linux/unaligned.h:28 fs/ceph/snap.c:500) Read of size 8 at addr ffff8880102a16c8 by task kworker/1:2/129 Workqueue: ceph-msgr cephconworkfn Call Trace: dumpstacklvl (lib/dumpstack.c:94 lib/dumpstack.c:120) printreport (mm/kasan/report.c:378 mm/kasan/report.c:482) kasanreport (mm/kasan/report.c:595) duparray (include/linux/unaligned.h:28 fs/ceph/snap.c:500) cephupdatesnaptrace (fs/ceph/snap.c:836) cephhandlesnap (fs/ceph/snap.c:1155) mdsdispatch (fs/ceph/mdsclient.c:7234) cephconprocessmessage (net/ceph/messenger.c:1424) cephconv1tryread (net/ceph/messengerv1.c:1430) cephconworkfn (net/ceph/messenger.c:1576) processonework (kernel/workqueue.c:3396) workerthread (kernel/workqueue.c:3479 kernel/workqueue.c:3560) kthread (kernel/kthread.c:436) retfromfork (arch/x86/kernel/process.c:158) retfromforkasm (arch/x86/entry/entry64.S:245) ... The buggy address is located 0 bytes to the right of allocated 72-byte region [ffff8880102a1680, ffff8880102a16c8)
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In the Ceph snap trace bounds check, compute the encoded-array length with size_add()/size_mul() so overflow saturates at SIZE_MAX instead of wrapping.