summaryrefslogtreecommitdiff
path: root/sys/compat/linux32
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
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')
-rw-r--r--sys/compat/linux32/arch/amd64/linux32_exec.h5
-rw-r--r--sys/compat/linux32/common/linux32_exec_elf32.c7
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/compat/linux32/arch/amd64/linux32_exec.h b/sys/compat/linux32/arch/amd64/linux32_exec.h
index 2eae333cdd4..d0ee4890339 100644
--- a/sys/compat/linux32/arch/amd64/linux32_exec.h
+++ b/sys/compat/linux32/arch/amd64/linux32_exec.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_exec.h,v 1.5 2014/02/09 16:41:42 chs Exp $ */
+/* $NetBSD: linux32_exec.h,v 1.6 2014/02/21 07:53:53 maxv Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -41,7 +41,8 @@
#define LINUX32_DEBUGLINK_SIGNATURE 1
-#define LINUX32_ELF_AUX_ENTRIES 14
+/* Counted from common/linux32_exec_elf32.c */
+#define LINUX32_ELF_AUX_ENTRIES 15
#define LINUX32_RANDOM_BYTES 16 /* 16 bytes for AT_RANDOM */
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;