os/drivers: add security fix for watchdog WDIOC_CAPTURE vulnerability - #7428
Open
vivek1-j wants to merge 2 commits into
Open
os/drivers: add security fix for watchdog WDIOC_CAPTURE vulnerability#7428vivek1-j wants to merge 2 commits into
vivek1-j wants to merge 2 commits into
Conversation
aashish-l
reviewed
Jul 3, 2026
|
|
||
| ret = register_driver(path, &g_wdogops, 0666, upper); | ||
| #ifdef CONFIG_BUILD_PROTECTED | ||
| ret = register_driver(path, &g_wdogops, 0600, upper); |
Contributor
There was a problem hiding this comment.
Kindly check if the file mode has any effect.
From functionality point of view, kindly check If "0600" mode should be set and if user space apps need to open and do operations using this driver.
Contributor
Author
There was a problem hiding this comment.
File mode doesn't seem to be having any effect, so, I'll revert this change completely, this will also maintain consistency with other drivers.
…ility Add comprehensive security test cases for watchdog driver vulnerability fix (finding-198). Tests validate that user-space callback pointers are properly rejected in protected builds. Changes: - apps/examples/testcase/le_tc/drivers/tc_watchdog_security.c: - New test file with 7 security test cases - apps/examples/testcase/le_tc/drivers/tc_internal.h: - Add watchdog_security_main() function declaration - apps/examples/testcase/le_tc/drivers/Kconfig: - Add CONFIG_TC_DRIVERS_WATCHDOG_SECURITY option (default y) - apps/examples/testcase/le_tc/drivers/Make.defs: - Add tc_watchdog_security.c to build when enabled - apps/examples/testcase/le_tc/drivers/drivers_tc_main.c: - Call watchdog_security_main() in test sequence Co-Authored-By: Vivek Jain <vivek1.j@samsung.com>
vivek1-j
force-pushed
the
29062026_watchdog_sec_vulnerability
branch
from
July 3, 2026 07:43
3e722db to
ae4835c
Compare
Fix security vulnerability finding-198 where watchdog ioctl accepts caller-controlled IRQ callback pointers. In protected builds, this allowed unprivileged applications to influence interrupt-context control flow by providing user-space callback addresses. Changes: - os/drivers/watchdog.c: - Add kernel space validation using is_kernel_space() - Change device permissions from 0666 to 0600 in protected builds - os/drivers/Kconfig: - Add CONFIG_WATCHDOG_CAPTURE_USER option for legacy/development mode - Default is 'n' (security enabled) for protected builds Security Impact: - Protected builds reject user-space callback pointers with -EPERM - Device access restricted to kernel/privileged code only - NULL callback still allowed (restores reset behavior) Authored-By: Vivek Jain <vivek1.j@samsung.com>
vivek1-j
force-pushed
the
29062026_watchdog_sec_vulnerability
branch
from
July 3, 2026 07:51
ae4835c to
91b26cb
Compare
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.
Problem Description
A high-severity security vulnerability (finding-198) was identified in the watchdog driver where the
WDIOC_CAPTUREioctl command accepts caller-controlled IRQ callback pointers without validation. In protected builds, this allows unprivileged applications to potentially hijack interrupt context control flow by providing user-space callback addresses.Security Impact:
Affected Components:
/dev/watchdog0ioctl interfaceos/drivers/watchdog.c- wdog_ioctl() functionSolution
The fix implements a multi-layer defense approach to secure the watchdog capture ioctl:
Layer 1 - Address Space Validation:
is_kernel_space()function to validate callback pointers-EPERMin protected buildsLayer 2 - Device Access Control:
Layer 3 - Configuration Control:
CONFIG_WATCHDOG_CAPTURE_USERoption for legacy compatibilityWhy is_kernel_space():
os/arch/arm/src/common/up_checkspace.cCONFIG_ARCH_HAVE_RAM_KERNEL_TEXTTest Plan
Test Environment:
drivers_tc(TizenRT testcase framework)Test Cases Developed (7 security tests):
Test Results Summary
rtl8730e (AmebaSmart)
BK7239N
Before/After Comparison
Files Changed
Modified Files:
os/drivers/watchdog.c- Security validation in wdog_ioctl()os/drivers/Kconfig- Added CONFIG_WATCHDOG_CAPTURE_USER optionapps/examples/testcase/le_tc/drivers/tc_internal.h- Test declarationsapps/examples/testcase/le_tc/drivers/Kconfig- Test configurationapps/examples/testcase/le_tc/drivers/Make.defs- Test build rulesapps/examples/testcase/le_tc/drivers/drivers_tc_main.c- Test integrationNew Files:
apps/examples/testcase/le_tc/drivers/tc_watchdog_security.c- Security test casesConfiguration
Required for Security:
Legacy Mode (Development Only):
Signed-off By: Vivek Jain (vivek1.j@samsung.com)