CONFIG_STACK_SENTINEL

Enable stack sentinel

Type: bool

Help

Store a magic value at the lowest addresses of a thread’s stack. Periodically check that this value is still present and kill the thread gracefully if it isn’t. This is currently checked in four places:

  1. Upon any context switch for the outgoing thread
  2. Any hardware interrupt that doesn’t context switch, the check is performed for the interrupted thread
  3. When a thread returns from its entry point
  4. When a thread calls k_yield() but doesn’t context switch

This feature doesn’t prevent corruption and the system may be in an unusable state. However, given the bizarre behavior associated with stack overflows, knowledge that this is happening is very useful.

This feature is intended for those systems which lack hardware support for stack overflow protection, or have insufficient system resources to use that hardware support.

Direct dependencies

!USERSPACE

(Includes any dependencies from if’s and menus.)

Defaults

No defaults. Implicitly defaults to n.

Symbols selected by this symbol

Kconfig definition

At subsys/debug/Kconfig:80

Included via Kconfig:10Kconfig.zephyr:39subsys/Kconfig:14

Menu path: (top menu) → Debugging Options

config STACK_SENTINEL
    bool
    prompt "Enable stack sentinel" if !USERSPACE
    select THREAD_STACK_INFO if !USERSPACE
    depends on !USERSPACE
    help
      Store a magic value at the lowest addresses of a thread's stack.
      Periodically check that this value is still present and kill the
      thread gracefully if it isn't. This is currently checked in four
      places:

      1) Upon any context switch for the outgoing thread
      2) Any hardware interrupt that doesn't context switch, the check is
         performed for the interrupted thread
      3) When a thread returns from its entry point
      4) When a thread calls k_yield() but doesn't context switch

      This feature doesn't prevent corruption and the system may be
      in an unusable state. However, given the bizarre behavior associated
      with stack overflows, knowledge that this is happening is very
      useful.

      This feature is intended for those systems which lack hardware support
      for stack overflow protection, or have insufficient system resources
      to use that hardware support.

(Definitions include propagated dependencies, including from if’s and menus.)