};
static struct dso *head, *tail, *libc;
+static int trust_env;
#define AUX_CNT 15
#define DYN_CNT 34
2, p->syms, p->strings, p);
do_relocs(p->base, (void *)(p->base+dyn[DT_RELA]), dyn[DT_RELASZ],
3, p->syms, p->strings, p);
+ p->relocated = 1;
+ }
+}
+
+static void free_all(struct dso *p)
+{
+ struct dso *n;
+ while (p) {
+ n = p->next;
+ if (p->map) free(p);
+ p = n;
}
}
/* At this point the standard library is fully functional */
+ /* Only trust user/env if kernel says we're not suid/sgid */
+ trust_env = (aux[0]&0x7800)==0x7800
+ && aux[AT_UID]==aux[AT_EUID]
+ && aux[AT_GID]==aux[AT_EGID];
+
head = tail = &app;
libc = &lib;
app.next = 0;
reloc_all(head);
+ free_all(head);
+
errno = 0;
return (void *)aux[AT_ENTRY];
}