CVE-2026-99893: ceph: clamp MDS reply result code to the errno range
In the Linux kernel, the following vulnerability has been resolved:
ceph: clamp MDS reply result code to the errno range
cephmdscwaitrequest() returns the reply head result code of the MDS request to its callers as a plain int errno. The value is a server-controlled u32 and nothing checks that it actually is an errno; several callers pass it straight to ERRPTR(), e.g. cephfinishlookup() on the atomic open path:
err = cephmdscwaitrequest(...) / e.g. +0x50fc00 / ... if (err) dentry = ERRPTR(err);
ISERR() only recognizes the [-MAXERRNO, -1] window, so an out-of-range value is not caught anywhere and survives as a "struct dentry ". On the open path the positive error travels cephfinishlookup() -> cephatomicopen() -> ERRPTR() in fs/namei.c's atomicopen() wrapper -> stepinto(), which dereferences it as a dentry and oopses (mainline 7.3-rc3-135-g4982d3552a3b, the value in R12 is the server-supplied result):
BUG: KASAN: probably user-memory-access in range [0x000000000050fc00-0x000000000050fc07] RIP: 0010:stepintoslowpath+0x3e3/0xe60 R12: 000000000050fc00 Call Trace: <TASK> ? pfxcephatomicopen+0x10/0x10 pathopenat+0xf41/0x2440 dofileopen+0x228/0x480 dosysopenat2+0x103/0x1d0 x64sysopenat+0x141/0x200 dosyscall64+0xe8/0x4f0 entrySYSCALL64afterhwframe+0x77/0x79 </TASK>
(0xdffffc00000a1f80 in the full report is the KASAN shadow of 0x50fc00; without KASAN the raw value is read.) Values with the top bit set fare no better: 0xd8000000 sign-extends through the int conversion into the kernel address range and takes a page fault instead.
Clamp the result at the single read and return -EIO for anything outside the errno range, which is what a malformed reply means there. net/9p does the same to server errno values with safeerrno(). This is the path the reported crash takes; the other readers of head->result, including the cephasynccreatecb() and cephasyncunlinkcb() callbacks, are not covered by this patch.
Each of the six crashing opens was run on a build of 7.3-rc3-135-g4982d3552a3bf with only this change applied: it crashes the unpatched kernel on the first openat() (verified on the same tree without the patch), and with the patch the open fails cleanly without an oops. A few hundred normal file operations on the patched kernel also completed without a crash; valid errno values pass through unchanged.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
At the single read of the Ceph MDS reply result code, return -EIO for values outside the errno range.
Event History
Frequently Asked Questions
Who is exposed to this issue?
Systems using the Linux kernel Ceph client are exposed when they communicate with an MDS that can return a crafted result code. The affected path is reached during an atomic open operation.
What does an attacker need to exploit it?
An attacker needs control of, or the ability to cause responses from, a Ceph MDS server. The exploit condition is an MDS reply containing a result value outside the kernel errno range.
What is the observable impact?
A positive, out-of-range reply value can be treated as a dentry pointer and dereferenced during pathname resolution. This can cause a kernel oops, with the reported trace involving ceph_atomic_open, path_openat, and step_into_slowpath.