[RFC][PATCH 06/24] kernel/task: Add "runtime" check for shadow stack support
From: Dave Hansen
Date: Wed Oct 21 2026 - 15:52:51 EST
Add a generic helper to see whether shadow stacks are supported at runtime.
This is needed to switch shadow stack code on and off at runtime. But, it
also serves to help the compiler optimize shadow stack code out as well.
---
b/include/linux/thread_info.h | 7 +++++++
1 file changed, 7 insertions(+)
diff -puN include/linux/thread_info.h~generic-arch-shadow-stacks-enabled include/linux/thread_info.h
--- a/include/linux/thread_info.h~generic-arch-shadow-stacks-enabled 2026-10-21 12:36:35.168875778 -0700
+++ b/include/linux/thread_info.h 2026-10-21 12:36:35.170875782 -0700
@@ -233,6 +233,13 @@ struct thread_stacks;
static inline void arch_init_thread_stacks(struct thread_stacks *ts) { }
#endif
+#ifndef arch_kernel_shstk_enabled
+static inline bool arch_kernel_shstk_enabled(void)
+{
+ return false;
+}
+#endif
+
void arch_task_cache_init(void); /* for CONFIG_SH */
void arch_release_task_struct(struct task_struct *tsk);
int arch_dup_task_struct(struct task_struct *dst,
_