From de1c01ad370948cab879d4adcdcac33e39ef4ecf Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 24 Jun 2005 17:41:28 +0000 Subject: Correct the amount of data to allocate in these local copies of exec_copyin_strings() to catch up to rev 1.266 of kern_exec.c. This fixes panics on amd64 with compat binaries since exec_free_args() was freeing more memory than these functions were allocating and the mismatch could cause memory to be freed out from under other concurrent execs. Approved by: re (scottl) --- sys/amd64/linux32/linux32_machdep.c | 3 ++- sys/compat/freebsd32/freebsd32_misc.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index fa15b2402a513..7f738bb5b2b81 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -113,7 +113,8 @@ linux_exec_copyin_args(struct image_args *args, char *fname, * Allocate temporary demand zeroed space for argument and * environment strings */ - args->buf = (char *) kmem_alloc_wait(exec_map, PATH_MAX + ARG_MAX); + args->buf = (char *) kmem_alloc_wait(exec_map, + PATH_MAX + ARG_MAX + MAXSHELLCMDLEN); if (args->buf == NULL) return (ENOMEM); args->begin_argv = args->buf; diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index ae61fbd90439b..940da4eec4658 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -237,7 +237,8 @@ freebsd32_exec_copyin_args(struct image_args *args, char *fname, * Allocate temporary demand zeroed space for argument and * environment strings */ - args->buf = (char *) kmem_alloc_wait(exec_map, PATH_MAX + ARG_MAX); + args->buf = (char *) kmem_alloc_wait(exec_map, + PATH_MAX + ARG_MAX + MAXSHELLCMDLEN); if (args->buf == NULL) return (ENOMEM); args->begin_argv = args->buf; -- cgit v1.3