Conversation
timer_gethandle() accepted any allocated timer in the system, so a process could set, read or delete another process's timer by its handle. Accept a handle only from a thread of the owner's process. The expiry callback runs in interrupt context, where the current task is unrelated, and is exempt. Signed-off-by: Royyan Zahir <royzah@gmail.com>
|
xiaoxiang781216
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note: Please adhere to Contributing Guidelines.
Summary
timer_gethandle()accepted any allocated timer in the system, so a process could set, read or delete another process's timer by its handle. Accept a handle only from a thread of the owner's process. The expiry callback runs in interrupt context, where the current task is unrelated, and is exempt.Impact
Every build with POSIX timers.
timer_settime(),timer_gettime(),timer_getoverrun()andtimer_delete()on another process's timer now fail withEINVAL. Threads of the owning process are unaffected.Testing
Host: Ubuntu 24.04, x86_64. Builds and runs in
ghcr.io/apache/nuttx/apache-nuttx-ci-linux(QEMU 6.2, Arm GNU GCC 13.2).sim:nsh, a task (separate process) using its parent's timerEINVAL, the owner keeps itqemu-armv8a:knshostestpasses, its POSIX timer test included;hellosim:ostest,qemu-armv7a:knshtools/checkpatch.sh -c -u -m -gclean.sim:nsh: another process's timer, master then this PRThe test, as
examples/hello:qemu-armv8a:knsh:hello, thenostest