aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/sched.h16
-rw-r--r--include/linux/stackprotector.h16
3 files changed, 31 insertions, 2 deletions
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 439f6f3cb0c4..561a5ff92c88 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -47,4 +47,5 @@
47#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA 47#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
48#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA 48#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
49 49
50#define STACK_END_MAGIC 0x57AC6E9D
50#endif /* __LINUX_MAGIC_H__ */ 51#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4cae9b81a1f8..a85b0cec7d12 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1157,10 +1157,9 @@ struct task_struct {
1157 pid_t pid; 1157 pid_t pid;
1158 pid_t tgid; 1158 pid_t tgid;
1159 1159
1160#ifdef CONFIG_CC_STACKPROTECTOR
1161 /* Canary value for the -fstack-protector gcc feature */ 1160 /* Canary value for the -fstack-protector gcc feature */
1162 unsigned long stack_canary; 1161 unsigned long stack_canary;
1163#endif 1162
1164 /* 1163 /*
1165 * pointers to (original) parent process, youngest child, younger sibling, 1164 * pointers to (original) parent process, youngest child, younger sibling,
1166 * older sibling, respectively. (p->father can be replaced with 1165 * older sibling, respectively. (p->father can be replaced with
@@ -2066,6 +2065,19 @@ static inline int object_is_on_stack(void *obj)
2066 2065
2067extern void thread_info_cache_init(void); 2066extern void thread_info_cache_init(void);
2068 2067
2068#ifdef CONFIG_DEBUG_STACK_USAGE
2069static inline unsigned long stack_not_used(struct task_struct *p)
2070{
2071 unsigned long *n = end_of_stack(p);
2072
2073 do { /* Skip over canary */
2074 n++;
2075 } while (!*n);
2076
2077 return (unsigned long)n - (unsigned long)end_of_stack(p);
2078}
2079#endif
2080
2069/* set thread flags in other task's structures 2081/* set thread flags in other task's structures
2070 * - see asm/thread_info.h for TIF_xxxx flags available 2082 * - see asm/thread_info.h for TIF_xxxx flags available
2071 */ 2083 */
diff --git a/include/linux/stackprotector.h b/include/linux/stackprotector.h
new file mode 100644
index 000000000000..6f3e54c704c0
--- /dev/null
+++ b/include/linux/stackprotector.h
@@ -0,0 +1,16 @@
1#ifndef _LINUX_STACKPROTECTOR_H
2#define _LINUX_STACKPROTECTOR_H 1
3
4#include <linux/compiler.h>
5#include <linux/sched.h>
6#include <linux/random.h>
7
8#ifdef CONFIG_CC_STACKPROTECTOR
9# include <asm/stackprotector.h>
10#else
11static inline void boot_init_stack_canary(void)
12{
13}
14#endif
15
16#endif