diff options
author | jhb <jhb@FreeBSD.org> | 2003-03-21 19:49:34 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-03-21 19:49:34 +0000 |
commit | 38bdc5fff0d6cc0edd89dcfd2a0e6c5388c6a00a (patch) | |
tree | 43550d8fe91a41ee3225185c991b731b4201205e /sys/compat | |
parent | cda1ad1e064fd4783b1518baa707b19bd947e746 (diff) | |
download | FreeBSD-src-38bdc5fff0d6cc0edd89dcfd2a0e6c5388c6a00a.zip FreeBSD-src-38bdc5fff0d6cc0edd89dcfd2a0e6c5388c6a00a.tar.gz |
Sync up linux and svr compat elf fixup functions for exec(). These
functions are now all basically identical except that alpha linux uses
Elf64 arguments and svr4 and i386 linux use Elf32. The fixups include
changing the first argument to be a register_t ** to match the prototype
for fixup functions, asserting that the process in the image_params struct
is always curproc and removing unnecessary locking to read credentials as a
result, and a few style fixes.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/svr4/svr4_sysvec.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c index 1d4ad6e..ec8ce8b 100644 --- a/sys/compat/svr4/svr4_sysvec.c +++ b/sys/compat/svr4/svr4_sysvec.c @@ -206,17 +206,19 @@ const char svr4_emul_path[] = "/compat/svr4"; static int svr4_fixup(register_t **stack_base, struct image_params *imgp) { - Elf32_Auxargs *args = (Elf32_Auxargs *)imgp->auxargs; + Elf32_Auxargs *args; register_t *pos; + KASSERT(curthread->td_proc == imgp->proc && + (curthread->td_proc->p_flag & P_THREADED) == 0, + ("unsafe svr4_fixup(), should be curproc")); + args = (Elf32_Auxargs *)imgp->auxargs; pos = *stack_base + (imgp->argc + imgp->envc + 2); - if (args->trace) { + if (args->trace) AUXARGS_ENTRY(pos, AT_DEBUG, 1); - } - if (args->execfd != -1) { + if (args->execfd != -1) AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); - } AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHENT, args->phent); AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); @@ -224,19 +226,17 @@ svr4_fixup(register_t **stack_base, struct image_params *imgp) AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY(pos, AT_BASE, args->base); - PROC_LOCK(imgp->proc); AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); - PROC_UNLOCK(imgp->proc); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; (*stack_base)--; - **stack_base = (int)imgp->argc; + **stack_base = (register_t)imgp->argc; return 0; } |