diff options
author | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-02-25 11:49:42 +0000 |
---|---|---|
committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-02-25 11:49:42 +0000 |
commit | 90dc539be0c5664c0700384027260e7ed60f3c4e (patch) | |
tree | 850254d8b3919e971cf675fe4ef7719a364188cd | |
parent | 88bf82a62e264debd5ccd4baad996442cf9a7d6b (diff) | |
download | src-90dc539be0c5664c0700384027260e7ed60f3c4e.tar.gz src-90dc539be0c5664c0700384027260e7ed60f3c4e.zip |
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>
Notes
Notes:
svn path=/head/; revision=142453
-rw-r--r-- | UPDATING | 5 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 14 | ||||
-rw-r--r-- | sys/sys/imgact.h | 4 |
3 files changed, 16 insertions, 7 deletions
@@ -22,6 +22,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 6.x IS SLOW: 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 compile in "device cpufreq" to restore this functionality. diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 98b52eaa9a17..7a15f754b374 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -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; } } diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index df79dfbd29ca..b1d0f0d09973 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -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 */ |