aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-11-01 14:46:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-11-01 14:46:27 -0400
commit2d6bb6adb714b133db92ccd4bfc9c20f75f71f3f (patch)
treeaef040a1ee4b8b6edc5a4fa2b3c6a2c48219f27a /fs/proc/base.c
parent7c6c54b505b8aea1782ce6a6e8f3b8297d179937 (diff)
parent6fcde90466738b84a073e4f4d18c50015ee29fb2 (diff)
Merge tag 'stackleak-v4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull stackleak gcc plugin from Kees Cook: "Please pull this new GCC plugin, stackleak, for v4.20-rc1. This plugin was ported from grsecurity by Alexander Popov. It provides efficient stack content poisoning at syscall exit. This creates a defense against at least two classes of flaws: - Uninitialized stack usage. (We continue to work on improving the compiler to do this in other ways: e.g. unconditional zero init was proposed to GCC and Clang, and more plugin work has started too). - Stack content exposure. By greatly reducing the lifetime of valid stack contents, exposures via either direct read bugs or unknown cache side-channels become much more difficult to exploit. This complements the existing buddy and heap poisoning options, but provides the coverage for stacks. The x86 hooks are included in this series (which have been reviewed by Ingo, Dave Hansen, and Thomas Gleixner). The arm64 hooks have already been merged through the arm64 tree (written by Laura Abbott and reviewed by Mark Rutland and Will Deacon). With VLAs having been removed this release, there is no need for alloca() protection, so it has been removed from the plugin" * tag 'stackleak-v4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: arm64: Drop unneeded stackleak_check_alloca() stackleak: Allow runtime disabling of kernel stack erasing doc: self-protection: Add information about STACKLEAK feature fs/proc: Show STACKLEAK metrics in the /proc file system lkdtm: Add a test for STACKLEAK gcc-plugins: Add STACKLEAK plugin for tracking the kernel stack x86/entry: Add STACKLEAK erasing the kernel stack at the end of syscalls
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c18
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
2909static 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
3011static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx) 3029static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx)