Page MenuHomeFreeBSD

D15485.id42715.diff
No OneTemporary

D15485.id42715.diff

Index: sys/kern/imgact_elf.c
===================================================================
--- sys/kern/imgact_elf.c
+++ sys/kern/imgact_elf.c
@@ -1098,11 +1098,14 @@
__elfN(freebsd_fixup)(register_t **stack_base, struct image_params *imgp)
{
Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs;
+ Elf_Auxinfo argarray[AT_COUNT], *pos;
Elf_Addr *base;
- Elf_Addr *pos;
+ Elf_Addr *auxbase;
+ int error;
base = (Elf_Addr *)*stack_base;
- pos = base + (imgp->args->argc + imgp->args->envc + 2);
+ auxbase = base + (imgp->args->argc + 1 + imgp->args->envc + 1);
+ pos = &argarray[0];
if (args->execfd != -1)
AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
@@ -1143,6 +1146,11 @@
free(imgp->auxargs, M_TEMP);
imgp->auxargs = NULL;
+ error = copyout(&argarray[0], auxbase, sizeof(argarray));
+ if (error != 0)
+ printf("%s: failed to copy out auxargs: error %d\n", __func__,
+ error);
+
base--;
suword(base, (long)imgp->args->argc);
*stack_base = (register_t *)base;
Index: sys/sys/imgact_elf.h
===================================================================
--- sys/sys/imgact_elf.h
+++ sys/sys/imgact_elf.h
@@ -37,7 +37,8 @@
#ifdef _KERNEL
-#define AUXARGS_ENTRY(pos, id, val) {suword(pos++, id); suword(pos++, val);}
+#define AUXARGS_ENTRY(pos, id, val) \
+ {(pos)->a_type = (id); (pos)++->a_un.a_val = (val);}
struct image_params;
struct thread;

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 26, 5:53 AM (2 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30366522
Default Alt Text
D15485.id42715.diff (1 KB)

Event Timeline