nuttx-apps/testing/drivers
Arnav Sharma b6bb99c951 testing/drivertest: add sensor watchdog regression test.
Issue apache/nuttx#20145 reported a sensor fetch-watchdog lifetime
regression: sensor_poll() arms a per-subscriber watchdog for
fetch-only sensors with a finite interval, but sensor_close()
freed the subscriber without cancelling it, letting
sensor_fetch_expired() run after free.

Fixed by apache/nuttx#20146, which cancels the watchdog on close.
Add regression coverage in drivertest as suggested by the maintainer:
open a sensor device, set a finite fetch interval, enter the poll
path so the watchdog can be armed, then close while the watchdog
state is relevant. Sleep past the interval so any stray timer would
fire, and reopen to prove teardown was clean. The test skips
gracefully when no sensor device is present, so it is safe on sim
without hardware.

The test does not deterministically reproduce the UAF; it verifies
the observable invariant that repeated poll/close/reopen cycles
complete cleanly and the device remains usable. Under KASAN or
stress, a missing wd_cancel in close would be caught here.

Impact:
* Is new feature added? YES (new regression test coverage in
  testing/drivers/drivertest, no existing functionality changed).
* Impact on user, build, hardware, documentation, security,
  compatibility? NO, test-only change.

Testing:
* Full build and runtime logs are provided in the PR description.

Assisted-by: Muse Spark:muse-spark-1.3
Assisted-by: Claude:claude-opus
Signed-off-by: Arnav Sharma <2006arnavsharma@gmail.com>
2026-09-18 21:10:56 +08:00
..
crypto testing/crypto: add SHA2-224 HMAC test case 2026-08-29 00:12:45 +08:00
drivertest testing/drivertest: add sensor watchdog regression test. 2026-09-18 21:10:56 +08:00
fftest testing/drivers/fftest/fftest.c: fix compilation error 2025-11-02 22:33:46 +08:00
nand_sim netutils/dropbear, testing/nand_sim: do not use fork() to run in background. 2026-08-03 09:22:39 -03:00
pcitest
rng/nist-sts cmake: Use NUTTX(_DIR/_BINARY_DIR) instead of CMAKE(_SOURCE_DIR/BINARY_DIR) 2026-08-09 10:43:01 -03:00
rpmsgdev testing: Move rpmsgdev to drivers/rpmsgdev 2025-01-26 09:53:02 -03:00
sd_stress testing/sd_stress: Harden file creation cleanup 2026-05-25 10:28:32 +08:00
ser testing: Add Serial Error Reporting testing app 2025-03-24 21:52:26 +08:00
setest testing: Move crypto/setest to drivers and open_memstream to libc 2025-01-26 07:32:53 +01:00
.gitignore
CMakeLists.txt
Make.defs
Makefile apps/testing: fix typo 2025-05-26 18:56:32 +02:00