Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Alexey Dobriyan and committed by
Linus Torvalds
c995f12a 70404fe3

+1 -1
+1 -1
kernel/sys.c
··· 2079 2079 * up to the caller to provide sane values here, otherwise userspace 2080 2080 * tools which use this vector might be unhappy. 2081 2081 */ 2082 - unsigned long user_auxv[AT_VECTOR_SIZE]; 2082 + unsigned long user_auxv[AT_VECTOR_SIZE] = {}; 2083 2083 2084 2084 if (len > sizeof(user_auxv)) 2085 2085 return -EINVAL;