Summary
Zephyr RTIO syscall verifiers fail to adequately validate certain user-supplied pointers before the kernel writes through them. On builds with both userspace and RTIO enabled, a user-mode thread may be able to modify kernel memory and potentially escalate privileges; a separate flaw can allow a thread with an RTIO context grant to affect another context's I/O.
Affected context
The issue affects Zephyr systems built with both CONFIG_USERSPACE and CONFIG_RTIO enabled. It occurs in RTIO syscall handling: the cancel verifier passes a user-supplied handle into kernel code without validating or bounding it, while the copy-in handle verifier does not verify that its output pointer references writable user memory. The cancel path also requires authorization for the RTIO context that owns the relevant submission pool.
Exploit preconditions
- Attack surface: RTIO syscalls exposed to user-mode threads.
- Required access: The cancel syscall requires a userspace build but no RTIO context grant; the copy-in handle path requires a grant to an RTIO context.
- Trigger point: Calling the cancel operation with a caller-controlled handle, or calling the copy-in operation with a caller-controlled output pointer.
- Why exploitation is possible: The kernel writes through insufficiently checked pointers. In the cancel path, it also follows a pointer chain without first restricting the handle to valid submission-pool storage.
- Configuration scope: Systems without
CONFIG_USERSPACEor withoutCONFIG_RTIOare unaffected.
Why this happens
The syscall verifiers do not establish that user-provided addresses are safe for the kernel's intended reads or writes. The cancel path treats an untrusted handle as an RTIO submission entry, modifies its flags, and follows its next pointer; the copy-in path checks for a non-NULL output pointer but does not confirm that it is writable user memory. This primarily maps to CWE-822: Untrusted Pointer Dereference, with the resulting kernel writes also relating to CWE-787: Out-of-bounds Write. Missing authorization for the context that owns a submission pool additionally relates to CWE-862: Missing Authorization.
Potential impact
- A user-mode thread could modify selected bits in kernel memory.
- Kernel data-structure corruption could lead to privilege escalation or compromise of system integrity.
- An invalid pointer chain could cause kernel faults or denial of service.
- A thread with an RTIO context grant could cancel submissions belonging to another context if ownership checks are absent, potentially interrupting its I/O.
General mitigation guidance
Defensive patterns focus on validating both pointer safety and resource ownership before kernel access:
- Check that user-provided output buffers are writable for the full size and duration of each kernel write.
- Convert handles to kernel objects only after confirming they fall within the owning submission pool and refer to valid entries.
- Require authorization for the RTIO context that owns the matched pool before permitting cancellation.
- Prefer bounded, kernel-managed handles over following caller-influenced pointer chains.
- Apply least privilege to userspace threads and expose only the RTIO contexts and operations they need.
How teams detect issues like this
- Use static analysis to identify syscall handlers that dereference or write through user pointers without memory-region checks.
- Review handle conversion and container macros for paths that accept untrusted addresses or follow pointer chains.
- Check that output parameters receive writable-memory validation and that resource operations enforce ownership grants.
- Add policy checks and review rules requiring bounds, memory-permission, and authorization checks at syscall boundaries.
- Use automated code-review tools to help flag unchecked user-pointer access and missing object-permission checks.

