diff options
Diffstat (limited to 'include/linux/stackleak.h')
-rw-r--r-- | include/linux/stackleak.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/stackleak.h b/include/linux/stackleak.h new file mode 100644 index 000000000000..628c2b947b89 --- /dev/null +++ b/include/linux/stackleak.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef _LINUX_STACKLEAK_H | ||
3 | #define _LINUX_STACKLEAK_H | ||
4 | |||
5 | #include <linux/sched.h> | ||
6 | #include <linux/sched/task_stack.h> | ||
7 | |||
8 | /* | ||
9 | * Check that the poison value points to the unused hole in the | ||
10 | * virtual memory map for your platform. | ||
11 | */ | ||
12 | #define STACKLEAK_POISON -0xBEEF | ||
13 | #define STACKLEAK_SEARCH_DEPTH 128 | ||
14 | |||
15 | #ifdef CONFIG_GCC_PLUGIN_STACKLEAK | ||
16 | #include <asm/stacktrace.h> | ||
17 | |||
18 | static inline void stackleak_task_init(struct task_struct *t) | ||
19 | { | ||
20 | t->lowest_stack = (unsigned long)end_of_stack(t) + sizeof(unsigned long); | ||
21 | } | ||
22 | #else /* !CONFIG_GCC_PLUGIN_STACKLEAK */ | ||
23 | static inline void stackleak_task_init(struct task_struct *t) { } | ||
24 | #endif | ||
25 | |||
26 | #endif | ||