]> git.baikalelectronics.ru Git - kernel.git/commit
prctl: fix PR_SET_MM_AUXV kernel stack leak
authorAlexey Dobriyan <adobriyan@gmail.com>
Sun, 14 Mar 2021 20:51:14 +0000 (23:51 +0300)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 14 Mar 2021 21:33:27 +0000 (14:33 -0700)
commitf4ee06e7570674ce8aa8b744667f677d25aaa306
tree92dd0fb652dcb361423365b28ee32888ab2257c8
parentd143a6a75e411bd6f0c6cc6324c6e17589f524be
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>
kernel/sys.c