summaryrefslogtreecommitdiff
path: root/sys/compat/linux32/common/linux32_exec_elf32.c
diff options
context:
space:
mode:
authormaxv <maxv@NetBSD.org>2014-02-21 07:53:53 +0000
committermaxv <maxv@NetBSD.org>2014-02-21 07:53:53 +0000
commitd91ba50b1f2201f6aece5635388d036fdcd2b58b (patch)
treeca42f6492c658263510e0dd53a3feca5b772e243 /sys/compat/linux32/common/linux32_exec_elf32.c
parent2c728e7209ae0e0fe3fcf7b24c2a60499f85e66c (diff)
Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase XX_AUX_ENTRIES's when adding vectors. Reported by martin@ (CV), with suggestions from chs@. ok martin@ chs@
Diffstat (limited to 'sys/compat/linux32/common/linux32_exec_elf32.c')
-rw-r--r--sys/compat/linux32/common/linux32_exec_elf32.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/compat/linux32/common/linux32_exec_elf32.c b/sys/compat/linux32/common/linux32_exec_elf32.c
index d506d7282a9..95f8edad621 100644
--- a/sys/compat/linux32/common/linux32_exec_elf32.c
+++ b/sys/compat/linux32/common/linux32_exec_elf32.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_exec_elf32.c,v 1.14 2014/02/09 16:41:42 chs Exp $ */
+/* $NetBSD: linux32_exec_elf32.c,v 1.15 2014/02/21 07:53:53 maxv Exp $ */
/*-
* Copyright (c) 1995, 1998, 2000, 2001,2006 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_exec_elf32.c,v 1.14 2014/02/09 16:41:42 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_exec_elf32.c,v 1.15 2014/02/21 07:53:53 maxv Exp $");
#define ELFSIZE 32
@@ -191,6 +191,8 @@ linux32_elf32_copyargs(struct lwp *l, struct exec_package *pack,
a++;
#if 0
+ /* XXX: increase LINUX32_ELF_AUX_ENTRIES if we enable those things */
+
a->a_type = LINUX_AT_SYSINFO;
a->a_v = NETBSD32PTR32I(&esdp->kernel_vsyscall[0]);
a++;
@@ -239,6 +241,7 @@ linux32_elf32_copyargs(struct lwp *l, struct exec_package *pack,
#endif
len = (a - ai) * sizeof(AuxInfo);
+ KASSERT(len <= LINUX32_ELF_AUX_ENTRIES);
if ((error = copyout(ai, *stackp, len)) != 0)
return error;
*stackp += len;