summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2005-01-29 23:12:00 +0000
committersobomax <sobomax@FreeBSD.org>2005-01-29 23:12:00 +0000
commitf489acaf0f5bae70444702cdcc02ab81d3b6b51a (patch)
treec697d47092272c8c6973b42ba0a424e9763f7ce5 /sys/compat
parent1c7b5012657233c6ea65df68e8223e60b6f822a0 (diff)
downloadFreeBSD-src-f489acaf0f5bae70444702cdcc02ab81d3b6b51a.zip
FreeBSD-src-f489acaf0f5bae70444702cdcc02ab81d3b6b51a.tar.gz
o Split out kernel part of execve(2) syscall into two parts: one that
copies arguments into the kernel space and one that operates completely in the kernel space; o use kernel-only version of execve(2) to kill another stackgap in linuxlator/i386. Obtained from: DragonFlyBSD (partially) MFC after: 2 weeks
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/ia32/ia32_sysvec.c14
-rw-r--r--sys/compat/pecoff/imgact_pecoff.c8
-rw-r--r--sys/compat/svr4/imgact_svr4.c5
-rw-r--r--sys/compat/svr4/svr4_sysvec.c4
4 files changed, 11 insertions, 20 deletions
diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c
index a2d1435..1052d61 100644
--- a/sys/compat/ia32/ia32_sysvec.c
+++ b/sys/compat/ia32/ia32_sysvec.c
@@ -183,7 +183,7 @@ ia32_copyout_strings(struct image_params *imgp)
arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS;
szsigcode = *(imgp->proc->p_sysent->sv_szsigcode);
destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE -
- roundup((ARG_MAX - imgp->stringspace), sizeof(char *));
+ roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
/*
* install sigcode
@@ -208,7 +208,7 @@ ia32_copyout_strings(struct image_params *imgp)
* the arg and env vector sets,and imgp->auxarg_size is room
* for argument of Runtime loader.
*/
- vectp = (u_int32_t *) (destp - (imgp->argc + imgp->envc + 2 +
+ vectp = (u_int32_t *) (destp - (imgp->args->argc + imgp->args->envc + 2 +
imgp->auxarg_size) * sizeof(u_int32_t));
} else
@@ -217,20 +217,20 @@ ia32_copyout_strings(struct image_params *imgp)
* the arg and env vector sets
*/
vectp = (u_int32_t *)
- (destp - (imgp->argc + imgp->envc + 2) * sizeof(u_int32_t));
+ (destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t));
/*
* vectp also becomes our initial stack base
*/
stack_base = vectp;
- stringp = imgp->stringbase;
- argc = imgp->argc;
- envc = imgp->envc;
+ stringp = imgp->args->begin_argv;
+ argc = imgp->args->argc;
+ envc = imgp->args->envc;
/*
* Copy out strings - arguments and environment.
*/
- copyout(stringp, destp, ARG_MAX - imgp->stringspace);
+ copyout(stringp, destp, ARG_MAX - imgp->args->stringspace);
/*
* Fill in "ps_strings" struct for ps, w, etc.
diff --git a/sys/compat/pecoff/imgact_pecoff.c b/sys/compat/pecoff/imgact_pecoff.c
index b15c65c..2039103 100644
--- a/sys/compat/pecoff/imgact_pecoff.c
+++ b/sys/compat/pecoff/imgact_pecoff.c
@@ -149,7 +149,7 @@ pecoff_fixup(register_t ** stack_base, struct image_params * imgp)
struct pecoff_imghdr *ap;
register_t *pos;
- pos = *stack_base + (imgp->argc + imgp->envc + 2);
+ pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2);
ap = (struct pecoff_imghdr *) imgp->auxargs;
if (copyout(ap, pos, len)) {
return 0;
@@ -157,7 +157,7 @@ pecoff_fixup(register_t ** stack_base, struct image_params * imgp)
free(ap, M_TEMP);
imgp->auxargs = NULL;
(*stack_base)--;
- suword(*stack_base, (long) imgp->argc);
+ suword(*stack_base, (long) imgp->args->argc);
return 0;
}
@@ -299,8 +299,6 @@ pecoff_load_file(struct thread * td, const char *file, u_long * addr, u_long * e
* Initialize part of the common data
*/
imgp->proc = td->td_proc;
- imgp->userspace_argv = NULL;
- imgp->userspace_envv = NULL;
imgp->execlabel = NULL;
imgp->attr = &attr;
imgp->firstpage = NULL;
@@ -418,8 +416,6 @@ exec_pecoff_coff_prep_zmagic(struct image_params * imgp,
wp = (void *) ((char *) ap + sizeof(struct coff_aouthdr));
error = pecoff_read_from(FIRST_THREAD_IN_PROC(imgp->proc), imgp->vp,
peofs + PECOFF_HDR_SIZE, (caddr_t) sh, scnsiz);
- if ((error = exec_extract_strings(imgp)) != 0)
- goto fail;
exec_new_vmspace(imgp, &pecoff_sysvec);
vmspace = imgp->proc->p_vmspace;
for (i = 0; i < fp->f_nscns; i++) {
diff --git a/sys/compat/svr4/imgact_svr4.c b/sys/compat/svr4/imgact_svr4.c
index 90d3b38..39eeb99 100644
--- a/sys/compat/svr4/imgact_svr4.c
+++ b/sys/compat/svr4/imgact_svr4.c
@@ -117,11 +117,6 @@ exec_svr4_imgact(imgp)
VOP_UNLOCK(imgp->vp, 0, td);
- /* copy in arguments and/or environment from old process */
- error = exec_extract_strings(imgp);
- if (error)
- goto fail;
-
/*
* Destroy old process VM and create a new one (with a new stack)
*/
diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c
index 496901a..80e54b0 100644
--- a/sys/compat/svr4/svr4_sysvec.c
+++ b/sys/compat/svr4/svr4_sysvec.c
@@ -215,7 +215,7 @@ svr4_fixup(register_t **stack_base, struct image_params *imgp)
(curthread->td_proc->p_flag & P_SA) == 0,
("unsafe svr4_fixup(), should be curproc"));
args = (Elf32_Auxargs *)imgp->auxargs;
- pos = *stack_base + (imgp->argc + imgp->envc + 2);
+ pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2);
if (args->trace)
AUXARGS_ENTRY(pos, AT_DEBUG, 1);
@@ -238,7 +238,7 @@ svr4_fixup(register_t **stack_base, struct image_params *imgp)
imgp->auxargs = NULL;
(*stack_base)--;
- **stack_base = (register_t)imgp->argc;
+ **stack_base = (register_t)imgp->args->argc;
return 0;
}
OpenPOWER on IntegriCloud