Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

driver: timer: npcx: fix timer accuracy issue #82905

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

ChiHuaL
Copy link
Contributor

@ChiHuaL ChiHuaL commented Dec 12, 2024

This PR contains patches to address the following issues:

  1. bypass timer counter reading issue
  2. fix possible vulnerabilities

This commit fixes some potential leakage in the timer driver.

Signed-off-by: Jun Lin <[email protected]>
Originally, when the timer's source clock is 32.768 kHz, the timer driver
uses two consecutive reads to ensure the timer reading is correct.
However, it is not robust enough due to an asynchronous timing issue in
the chip. The workaround is to add at least two NOPs between the
LDR and CMP instructions. This commit implements the workaround in the
assembly code to ensure it is not affected by the compiler toolchain
or optimization flags.

Signed-off-by: Jun Lin <[email protected]>
@ChiHuaL ChiHuaL force-pushed the fix_leak_timer_driver branch from f5e1760 to f5077e1 Compare December 12, 2024 07:58
@ChiHuaL ChiHuaL marked this pull request as ready for review December 12, 2024 10:04
@zephyrbot zephyrbot added the area: Timer Timer label Dec 12, 2024
@zephyrbot zephyrbot requested review from andyross and teburd December 12, 2024 10:05
@ChiHuaL
Copy link
Contributor Author

ChiHuaL commented Dec 12, 2024

@fabiobaltieri This PR is the fix of the issue:361773754.

Copy link
Member

@fabiobaltieri fabiobaltieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, thanks for all the troubleshooting work on this

@kartben kartben merged commit 2bda7b8 into zephyrproject-rtos:main Dec 16, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants