From dd574f6ec76ba38d2367493dc06696b86a2ce606 Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Fri, 28 May 2021 14:17:37 +0200 Subject: [PATCH] kernel: stack_sentinel: disable in single-threaded builds Add a dependency on MULTITHREADING for the STACK_SENTINEL feature, so it may not get enabled in single-thread Zephyr builds. Signed-off-by: Ioannis Glaropoulos --- kernel/thread.c | 4 ++-- subsys/debug/Kconfig | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/thread.c b/kernel/thread.c index b692d6c76d9..5236c0ca5c2 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -328,6 +328,7 @@ static inline int z_vrfy_k_thread_name_copy(k_tid_t thread, #endif /* CONFIG_USERSPACE */ +#ifdef CONFIG_MULTITHREADING #ifdef CONFIG_STACK_SENTINEL /* Check that the stack sentinel is still present * @@ -359,9 +360,8 @@ void z_check_stack_sentinel(void) z_except_reason(K_ERR_STACK_CHK_FAIL); } } -#endif +#endif /* CONFIG_STACK_SENTINEL */ -#ifdef CONFIG_MULTITHREADING void z_impl_k_thread_start(struct k_thread *thread) { SYS_PORT_TRACING_OBJ_FUNC(k_thread, start, thread); diff --git a/subsys/debug/Kconfig b/subsys/debug/Kconfig index cf3431586b2..420a304903a 100644 --- a/subsys/debug/Kconfig +++ b/subsys/debug/Kconfig @@ -139,6 +139,7 @@ config STACK_USAGE config STACK_SENTINEL bool "Enable stack sentinel" select THREAD_STACK_INFO + depends on MULTITHREADING depends on !USERSPACE help Store a magic value at the lowest addresses of a thread's stack.