CVE-2026-102957: PWM capture syscall leaves callback armed on a dead kernel stack frame when called with K_NO_WAIT

Published Nov 25, 2026
·
Updated

zimplpwmcapturecycles() in drivers/pwm/pwmcapture.c stores its capture context (struct zpwmcapturecbdata, including a struct ksem) on its own stack and registers a pointer to it as the driver capture callback's userdata. When called with a KNOWAIT timeout, ksemtake() returns -EBUSY, which the function did not handle: it fell through, returned the uninitialized status field, copied uninitialized period/pulse values to the caller when that status happened to be zero, and returned without disabling the capture or clearing the callback.

pwmcapturecycles() is a system call, and zvrfypwmcapturecycles() passes the caller's timeout through unchanged. With CONFIGUSERSPACE and CONFIGPWMCAPTURE enabled, an unprivileged user-mode thread that has been granted access to a capture-capable PWM device can pass KNOWAIT to trigger the defect. Without userspace the function is only reachable from trusted application code.

The uninitialized values come from the thread's privileged (kernel) stack, so a user-mode caller can read up to 8 bytes of stale kernel stack memory per call. More seriously, when the capture later completes, the driver ISR invokes zpwmcapturecyclescallback() with the dangling pointer. The callback writes into the expired kernel stack region and calls ksemgive() on whatever memory now occupies it, which can corrupt live kernel stack frames and make the scheduler walk a forged wait queue. The result is kernel memory corruption from interrupt context, leading at least to a crash and possibly to privilege escalation out of the userspace sandbox. The fix rejects KNOWAIT with -EINVAL before any capture is configured.

Affected Software

1 affected component
Zephyr Project Zephyr

Event History

Nov 25, 2026
CVE Published
via MITRE·08:27 PM
Data Sourced
via MITRE·08:27 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed to unprivileged exploitation?

Unprivileged exploitation requires both CONFIG_USERSPACE and CONFIG_PWM_CAPTURE, plus a user-mode thread that has been granted access to a PWM device capable of capture. Without userspace, the syscall is reachable only from trusted application code.

2

What must an attacker do to trigger the issue?

The caller must invoke pwm_capture_cycles() with a K_NO_WAIT timeout. This causes k_sem_take() to return -EBUSY, after which the capture callback can remain registered with user_data pointing to a stack frame that has already returned.

3

What can a successful trigger expose or affect?

A user-mode caller may receive up to 8 bytes of stale privileged kernel-stack memory per call through uninitialized period and pulse values. A later capture completion also causes the driver ISR to invoke a callback using the stale stack-backed context.

4

What can be done if an update cannot be applied immediately?

Do not grant unprivileged user-mode threads access to capture-capable PWM devices, and avoid calling the capture syscall with K_NO_WAIT. Systems without CONFIG_USERSPACE do not expose this path to unprivileged callers.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203