Skip to content

Commit c995f12

Browse files
Alexey Dobriyantorvalds
authored andcommitted
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>
1 parent 70404fe commit c995f12

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ static int prctl_set_auxv(struct mm_struct *mm, unsigned long addr,
20792079
* up to the caller to provide sane values here, otherwise userspace
20802080
* tools which use this vector might be unhappy.
20812081
*/
2082-
unsigned long user_auxv[AT_VECTOR_SIZE];
2082+
unsigned long user_auxv[AT_VECTOR_SIZE] = {};
20832083

20842084
if (len > sizeof(user_auxv))
20852085
return -EINVAL;

0 commit comments

Comments
 (0)