summaryrefslogtreecommitdiffstats
path: root/kernel/stackleak.c
diff options
context:
space:
mode:
authorAlexander Popov <alex.popov@linux.com>2018-08-16 18:17:01 -0400
committerKees Cook <keescook@chromium.org>2018-09-04 13:35:48 -0400
commitc8d126275a5fa59394fe17109bdb9812fed296b8 (patch)
tree81be08434798afffb46681c2625c0d16e4e188cc /kernel/stackleak.c
parentf90d1e0c7804b52e12fea501aa46a12c1ff6a567 (diff)
fs/proc: Show STACKLEAK metrics in the /proc file system
Introduce CONFIG_STACKLEAK_METRICS providing STACKLEAK information about tasks via the /proc file system. In particular, /proc/<pid>/stack_depth shows the maximum kernel stack consumption for the current and previous syscalls. Although this information is not precise, it can be useful for estimating the STACKLEAK performance impact for your workloads. Suggested-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Alexander Popov <alex.popov@linux.com> Tested-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'kernel/stackleak.c')
-rw-r--r--kernel/stackleak.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/stackleak.c b/kernel/stackleak.c
index 628485db37ba..f66239572c89 100644
--- a/kernel/stackleak.c
+++ b/kernel/stackleak.c
@@ -41,6 +41,10 @@ asmlinkage void stackleak_erase(void)
41 if (kstack_ptr == boundary) 41 if (kstack_ptr == boundary)
42 kstack_ptr += sizeof(unsigned long); 42 kstack_ptr += sizeof(unsigned long);
43 43
44#ifdef CONFIG_STACKLEAK_METRICS
45 current->prev_lowest_stack = kstack_ptr;
46#endif
47
44 /* 48 /*
45 * Now write the poison value to the kernel stack. Start from 49 * Now write the poison value to the kernel stack. Start from
46 * 'kstack_ptr' and move up till the new 'boundary'. We assume that 50 * 'kstack_ptr' and move up till the new 'boundary'. We assume that