aboutsummaryrefslogtreecommitdiff
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2018-10-11 23:07:30 +0200
committerWolfram Sang <wsa@the-dreams.de>2018-10-11 23:07:30 +0200
commit90fb814b6c025da45f71db1703cffe3fe87f575c (patch)
tree5fd739d407654df6f9d6e82900a45e027dd8b9f0 /fs/proc/base.c
parentb30f2f65568f840e5ca522d98ba2ad73b8f59cde (diff)
parent0238df646e6224016a45505d2c111a24669ebe21 (diff)
Merge tag 'v4.19-rc7' into i2c/for-4.20
This is the 4.19-rc7 release
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index ccf86f16d9f0..7e9f07bf260d 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -407,6 +407,20 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
unsigned long *entries;
int err;
+ /*
+ * The ability to racily run the kernel stack unwinder on a running task
+ * and then observe the unwinder output is scary; while it is useful for
+ * debugging kernel issues, it can also allow an attacker to leak kernel
+ * stack contents.
+ * Doing this in a manner that is at least safe from races would require
+ * some work to ensure that the remote task can not be scheduled; and
+ * even then, this would still expose the unwinder as local attack
+ * surface.
+ * Therefore, this interface is restricted to root.
+ */
+ if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN))
+ return -EACCES;
+
entries = kmalloc_array(MAX_STACK_TRACE_DEPTH, sizeof(*entries),
GFP_KERNEL);
if (!entries)