1*afaef01cSAlexander Popov /* SPDX-License-Identifier: GPL-2.0 */ 2*afaef01cSAlexander Popov #ifndef _LINUX_STACKLEAK_H 3*afaef01cSAlexander Popov #define _LINUX_STACKLEAK_H 4*afaef01cSAlexander Popov 5*afaef01cSAlexander Popov #include <linux/sched.h> 6*afaef01cSAlexander Popov #include <linux/sched/task_stack.h> 7*afaef01cSAlexander Popov 8*afaef01cSAlexander Popov /* 9*afaef01cSAlexander Popov * Check that the poison value points to the unused hole in the 10*afaef01cSAlexander Popov * virtual memory map for your platform. 11*afaef01cSAlexander Popov */ 12*afaef01cSAlexander Popov #define STACKLEAK_POISON -0xBEEF 13*afaef01cSAlexander Popov #define STACKLEAK_SEARCH_DEPTH 128 14*afaef01cSAlexander Popov 15*afaef01cSAlexander Popov #ifdef CONFIG_GCC_PLUGIN_STACKLEAK 16*afaef01cSAlexander Popov #include <asm/stacktrace.h> 17*afaef01cSAlexander Popov 18*afaef01cSAlexander Popov static inline void stackleak_task_init(struct task_struct *t) 19*afaef01cSAlexander Popov { 20*afaef01cSAlexander Popov t->lowest_stack = (unsigned long)end_of_stack(t) + sizeof(unsigned long); 21*afaef01cSAlexander Popov } 22*afaef01cSAlexander Popov #else /* !CONFIG_GCC_PLUGIN_STACKLEAK */ 23*afaef01cSAlexander Popov static inline void stackleak_task_init(struct task_struct *t) { } 24*afaef01cSAlexander Popov #endif 25*afaef01cSAlexander Popov 26*afaef01cSAlexander Popov #endif 27