mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-04 20:58:03 +00:00
A test that a user process which makes a forbidden access is stopped, and that nothing else is. It spawns this program again as a separate process to make the access, because a kernel build does not give user code task_create(), and checks that the offender died, that the caller still runs and that a canary thread kept counting. The canary is what tells "the offender was contained" from "the whole system stopped". Every target has the outcome it expects: self the process's own data must succeed kernel kernel memory must fault periph a peripheral register must fault unmapped an address with no mapping must fault "self" is the control. Without it a build that refuses every access passes every other check. An MMU keeps processes apart but does not stop one reaching a peripheral, and an unmapped access is refused by another mechanism again, so neither is covered by the kernel target. The offender allocates memory and opens a file before the access. The test reads /proc/meminfo and /proc/<pid>/group/fd while it lives and after it is reaped, and fails if the counts never rose, since "the same before and after" says nothing if the resources were never seen. The addresses come from Kconfig, because a user process cannot see kernel symbols. A protected build derives the kernel target from CONFIG_NUTTX_USERSPACE when none is set. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com> |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| Kconfig | ||
| Make.defs | ||
| Makefile | ||
| sandbox_main.c | ||