diff options
author | kib <kib@FreeBSD.org> | 2009-03-17 12:53:28 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2009-03-17 12:53:28 +0000 |
commit | e905171fbe93556305cb1fa0334861bd122339d2 (patch) | |
tree | d8727e59a354ad0a3bffae93cc41c3c6011692c8 /sys/compat/ia32 | |
parent | 7695aca762c11a65c2cb77f36c495e0e77dcd2aa (diff) | |
download | FreeBSD-src-e905171fbe93556305cb1fa0334861bd122339d2.zip FreeBSD-src-e905171fbe93556305cb1fa0334861bd122339d2.tar.gz |
Supply AT_EXECPATH auxinfo entry to the interpreter, both for native and
compat32 binaries.
Tested by: pho
Reviewed by: kan
Diffstat (limited to 'sys/compat/ia32')
-rw-r--r-- | sys/compat/ia32/ia32_sysvec.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index e5d8828..2b7ecba 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -189,15 +189,21 @@ ia32_copyout_strings(struct image_params *imgp) char *stringp, *destp; u_int32_t *stack_base; struct freebsd32_ps_strings *arginfo; + size_t execpath_len; int szsigcode; /* * Calculate string base and vector table pointers. * Also deal with signal trampoline code for this exec type. */ + if (imgp->execpath != NULL && imgp->auxargs != NULL) + execpath_len = strlen(imgp->execpath) + 1; + else + execpath_len = 0; arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS; szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - + roundup(execpath_len, sizeof(char *)) - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); /* @@ -208,6 +214,15 @@ ia32_copyout_strings(struct image_params *imgp) ((caddr_t)arginfo - szsigcode), szsigcode); /* + * Copy the image path for the rtld. + */ + if (execpath_len != 0) { + imgp->execpathp = (uintptr_t)arginfo - szsigcode - execpath_len; + copyout(imgp->execpath, (void *)imgp->execpathp, + execpath_len); + } + + /* * If we have a valid auxargs ptr, prepare some room * on the stack. */ @@ -223,9 +238,9 @@ 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->args->argc + imgp->args->envc + 2 + - imgp->auxarg_size) * sizeof(u_int32_t)); - + vectp = (u_int32_t *) (destp - (imgp->args->argc + + imgp->args->envc + 2 + imgp->auxarg_size + execpath_len) * + sizeof(u_int32_t)); } else /* * The '+ 2' is for the null pointers at the end of each of |