summaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2021-03-14 21:51:14 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2021-03-14 22:33:27 +0100
commitc995f12ad8842dbf5cfed113fb52cdd083f5afd1 (patch)
tree92dd0fb652dcb361423365b28ee32888ab2257c8 /kernel/sys.c
parentMerge tag 'irq-urgent-2021-03-14' of git://git.kernel.org/pub/scm/linux/kerne... (diff)
downloadlinux-c995f12ad8842dbf5cfed113fb52cdd083f5afd1.tar.xz
linux-c995f12ad8842dbf5cfed113fb52cdd083f5afd1.zip
prctl: fix PR_SET_MM_AUXV kernel stack leak
Doing a prctl(PR_SET_MM, PR_SET_MM_AUXV, addr, 1); will copy 1 byte from userspace to (quite big) on-stack array and then stash everything to mm->saved_auxv. AT_NULL terminator will be inserted at the very end. /proc/*/auxv handler will find that AT_NULL terminator and copy original stack contents to userspace. This devious scheme requires CAP_SYS_RESOURCE. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--kernel/sys.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index b09fe21e88ff..2e2e3f378d97 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2079,7 +2079,7 @@ static int prctl_set_auxv(struct mm_struct *mm, unsigned long addr,
* up to the caller to provide sane values here, otherwise userspace
* tools which use this vector might be unhappy.
*/
- unsigned long user_auxv[AT_VECTOR_SIZE];
+ unsigned long user_auxv[AT_VECTOR_SIZE] = {};
if (len > sizeof(user_auxv))
return -EINVAL;