Race Against Time in the Kernel’s Clockwork #1395
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤖 Automated Content Update
This PR was automatically generated by the HackTricks News Bot based on a technical blog post.
📝 Source Information
🎯 Content Summary
CVE-2025-38352 — TOCTOU race in Linux/Android
posix-cpu-timers
that corrupts timer state when an exiting task processes expiries in IRQ context while another thread deletes the same timer. This can crash the kernel and, in some scenarios, be steered toward privilege escalation. Affected file:kernel/time/posix-cpu-timers.c
.How POSIX CPU timers work (concise internals you need for exploitation)
• Three CPU clock types (read by
cpu_clock_...
🔧 Technical Details
Abstracted race technique: expiry vs. deletion under task exit
Force CPU-timer expiry for a victim thread while it is exiting and ensure the kernel takes the IRQ-context path (i.e.,
CONFIG_POSIX_CPU_TIMERS_TASK_WORK=n
). The expiry path setsctmr->firing=1
and then dropssighand
. Concurrently invoke the timer’s delete operation from another thread. Because task lookup/locking may fail during exit, the delete path can skip the usual in‑flight guard (if (timer->it.cpu.firing)
), causing inconsistent state during delivery. The core trick is to exploit the small window betweenunlock_task_sighand()
and the firing loop to make deletion proceed as if not in flight.🤖 Agent Actions
I analyzed the blog and the HackTricks repository, and found no existing page covering Linux kernel POSIX CPU timers race conditions. The content is highly technical and directly relevant, so I:
Summary of changes implemented:
References added:
No other similar content existed in the repository, so a new page was necessary and it’s properly linked from a related, high-visibility location.
This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.
📚 Repository Maintenance
All .md files have been checked for proper formatting (headers, includes, etc.).
🗑️ File Cleanup