diff options
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 7e9f07bf260d..ce3465479447 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2905,6 +2905,21 @@ static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns, | |||
2905 | } | 2905 | } |
2906 | #endif /* CONFIG_LIVEPATCH */ | 2906 | #endif /* CONFIG_LIVEPATCH */ |
2907 | 2907 | ||
2908 | #ifdef CONFIG_STACKLEAK_METRICS | ||
2909 | static int proc_stack_depth(struct seq_file *m, struct pid_namespace *ns, | ||
2910 | struct pid *pid, struct task_struct *task) | ||
2911 | { | ||
2912 | unsigned long prev_depth = THREAD_SIZE - | ||
2913 | (task->prev_lowest_stack & (THREAD_SIZE - 1)); | ||
2914 | unsigned long depth = THREAD_SIZE - | ||
2915 | (task->lowest_stack & (THREAD_SIZE - 1)); | ||
2916 | |||
2917 | seq_printf(m, "previous stack depth: %lu\nstack depth: %lu\n", | ||
2918 | prev_depth, depth); | ||
2919 | return 0; | ||
2920 | } | ||
2921 | #endif /* CONFIG_STACKLEAK_METRICS */ | ||
2922 | |||
2908 | /* | 2923 | /* |
2909 | * Thread groups | 2924 | * Thread groups |
2910 | */ | 2925 | */ |
@@ -3006,6 +3021,9 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
3006 | #ifdef CONFIG_LIVEPATCH | 3021 | #ifdef CONFIG_LIVEPATCH |
3007 | ONE("patch_state", S_IRUSR, proc_pid_patch_state), | 3022 | ONE("patch_state", S_IRUSR, proc_pid_patch_state), |
3008 | #endif | 3023 | #endif |
3024 | #ifdef CONFIG_STACKLEAK_METRICS | ||
3025 | ONE("stack_depth", S_IRUGO, proc_stack_depth), | ||
3026 | #endif | ||
3009 | }; | 3027 | }; |
3010 | 3028 | ||
3011 | static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx) | 3029 | static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx) |