Welcome to the 21st century: increase MAXSHELLCMDLEN from 128 bytes to

PAGE_SIZE.

Unlike originator of the PR suggests retain MAXSHELLCMDLEN definition
(he has been proposing to replace it with PAGE_SIZE everywhere), not only
this reduced the diff significantly, but prevents code obfuscation and also
allows to increase/decrease this parameter easily if needed.

PR:		kern/64196
Submitted by:	Magnus Bäckström <b@etek.chalmers.se>
This commit is contained in:
Maxim Sobolev 2005-02-25 11:49:42 +00:00
parent 88bf82a62e
commit 90dc539be0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142453
3 changed files with 16 additions and 7 deletions

View File

@ -21,6 +21,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 6.x IS SLOW:
developers choose to disable these features on build machines
to maximize performance.
20050223:
The layout of struct image_params has changed. You have to
recompile all compatibility modules (linux, svr4, etc) for use
with the new kernel.
20050223:
The p4tcc driver has been merged into cpufreq(4). This makes
"options CPU_ENABLE_TCC" obsolete. Please load cpufreq.ko or

View File

@ -320,7 +320,7 @@ do_execve(td, args, mac_p)
imgp->entry_addr = 0;
imgp->vmspace_destroyed = 0;
imgp->interpreted = 0;
imgp->interpreter_name[0] = '\0';
imgp->interpreter_name = args->buf + PATH_MAX + ARG_MAX;
imgp->auxargs = NULL;
imgp->vp = NULL;
imgp->object = NULL;
@ -931,9 +931,13 @@ exec_copyin_args(struct image_args *args, char *fname,
return (EFAULT);
/*
* Allocate temporary demand zeroed space for argument and
* environment strings
* environment strings:
*
* o ARG_MAX for argument and environment;
* o MAXSHELLCMDLEN for the name of interpreters.
*/
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;
@ -997,8 +1001,8 @@ exec_free_args(struct image_args *args)
{
if (args->buf) {
kmem_free_wakeup(exec_map,
(vm_offset_t)args->buf, PATH_MAX + ARG_MAX);
kmem_free_wakeup(exec_map, (vm_offset_t)args->buf,
PATH_MAX + ARG_MAX + MAXSHELLCMDLEN);
args->buf = NULL;
}
}

View File

@ -34,7 +34,7 @@
#include <sys/uio.h>
#define MAXSHELLCMDLEN 128
#define MAXSHELLCMDLEN PAGE_SIZE
struct image_args {
char *buf; /* pointer to string buffer */
@ -57,7 +57,7 @@ struct image_params {
unsigned long entry_addr; /* entry address of target executable */
char vmspace_destroyed; /* flag - we've blown away original vm space */
char interpreted; /* flag - this executable is interpreted */
char interpreter_name[MAXSHELLCMDLEN]; /* name of the interpreter */
char *interpreter_name; /* name of the interpreter */
void *auxargs; /* ELF Auxinfo structure pointer */
struct sf_buf *firstpage; /* first page that we mapped */
unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */