stackprotector: use canary at end of stack to indicate overruns at oops time
[deliverable/linux.git] / include / linux / sched.h
index d6a515158783e721392872c6598313b64b5c9f8c..c5181e77f3052bfdd557168dc303b87f76e229cd 100644 (file)
@@ -1969,6 +1969,19 @@ static inline unsigned long *end_of_stack(struct task_struct *p)
 
 extern void thread_info_cache_init(void);
 
+#ifdef CONFIG_DEBUG_STACK_USAGE
+static inline unsigned long stack_not_used(struct task_struct *p)
+{
+       unsigned long *n = end_of_stack(p);
+
+       do {    /* Skip over canary */
+               n++;
+       } while (!*n);
+
+       return (unsigned long)n - (unsigned long)end_of_stack(p);
+}
+#endif
+
 /* set thread flags in other task's structures
  * - see asm/thread_info.h for TIF_xxxx flags available
  */
This page took 0.024266 seconds and 5 git commands to generate.