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)
This commit is contained in:
John Baldwin 2005-06-24 17:41:28 +00:00
parent 21ce09ca81
commit de1c01ad37
2 changed files with 4 additions and 2 deletions

View File

@ -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;

View File

@ -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;