Changed the type used to represent the user stack pointer from `long *'
to `register_t *'. This fixes bugs like misplacement of argc and argv on the user stack on i386's with 64-bit longs. We still use longs to represent "words" like argc and argv, and assume that they are on the stack (and that there is stack). The suword() and fuword() families should also use register_t.
This commit is contained in:
parent
9f79feec16
commit
654f6be1c8
@ -66,9 +66,9 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
|
||||
|
||||
extern struct linker_set linux_ioctl_handler_set;
|
||||
|
||||
static int linux_fixup __P((long **stack_base,
|
||||
static int linux_fixup __P((register_t **stack_base,
|
||||
struct image_params *iparams));
|
||||
static int elf_linux_fixup __P((long **stack_base,
|
||||
static int elf_linux_fixup __P((register_t **stack_base,
|
||||
struct image_params *iparams));
|
||||
static void linux_prepsyscall __P((struct trapframe *tf, int *args,
|
||||
u_int *code, caddr_t *params));
|
||||
@ -133,9 +133,9 @@ translate_traps(int signal, int trap_code)
|
||||
}
|
||||
|
||||
static int
|
||||
linux_fixup(long **stack_base, struct image_params *imgp)
|
||||
linux_fixup(register_t **stack_base, struct image_params *imgp)
|
||||
{
|
||||
long *argv, *envp;
|
||||
register_t *argv, *envp;
|
||||
|
||||
argv = *stack_base;
|
||||
envp = *stack_base + (imgp->argc + 1);
|
||||
@ -149,10 +149,10 @@ linux_fixup(long **stack_base, struct image_params *imgp)
|
||||
}
|
||||
|
||||
static int
|
||||
elf_linux_fixup(long **stack_base, struct image_params *imgp)
|
||||
elf_linux_fixup(register_t **stack_base, struct image_params *imgp)
|
||||
{
|
||||
Elf32_Auxargs *args = (Elf32_Auxargs *)imgp->auxargs;
|
||||
long *pos;
|
||||
register_t *pos;
|
||||
|
||||
pos = *stack_base + (imgp->argc + imgp->envc + 2);
|
||||
|
||||
|
@ -66,9 +66,9 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
|
||||
|
||||
extern struct linker_set linux_ioctl_handler_set;
|
||||
|
||||
static int linux_fixup __P((long **stack_base,
|
||||
static int linux_fixup __P((register_t **stack_base,
|
||||
struct image_params *iparams));
|
||||
static int elf_linux_fixup __P((long **stack_base,
|
||||
static int elf_linux_fixup __P((register_t **stack_base,
|
||||
struct image_params *iparams));
|
||||
static void linux_prepsyscall __P((struct trapframe *tf, int *args,
|
||||
u_int *code, caddr_t *params));
|
||||
@ -133,9 +133,9 @@ translate_traps(int signal, int trap_code)
|
||||
}
|
||||
|
||||
static int
|
||||
linux_fixup(long **stack_base, struct image_params *imgp)
|
||||
linux_fixup(register_t **stack_base, struct image_params *imgp)
|
||||
{
|
||||
long *argv, *envp;
|
||||
register_t *argv, *envp;
|
||||
|
||||
argv = *stack_base;
|
||||
envp = *stack_base + (imgp->argc + 1);
|
||||
@ -149,10 +149,10 @@ linux_fixup(long **stack_base, struct image_params *imgp)
|
||||
}
|
||||
|
||||
static int
|
||||
elf_linux_fixup(long **stack_base, struct image_params *imgp)
|
||||
elf_linux_fixup(register_t **stack_base, struct image_params *imgp)
|
||||
{
|
||||
Elf32_Auxargs *args = (Elf32_Auxargs *)imgp->auxargs;
|
||||
long *pos;
|
||||
register_t *pos;
|
||||
|
||||
pos = *stack_base + (imgp->argc + imgp->envc + 2);
|
||||
|
||||
|
@ -69,7 +69,7 @@ __ElfType(Brandinfo);
|
||||
__ElfType(Auxargs);
|
||||
|
||||
static int elf_check_header __P((const Elf_Ehdr *hdr));
|
||||
static int elf_freebsd_fixup __P((long **stack_base,
|
||||
static int elf_freebsd_fixup __P((register_t **stack_base,
|
||||
struct image_params *imgp));
|
||||
static int elf_load_file __P((struct proc *p, const char *file, u_long *addr,
|
||||
u_long *entry));
|
||||
@ -622,10 +622,10 @@ exec_elf_imgact(struct image_params *imgp)
|
||||
}
|
||||
|
||||
static int
|
||||
elf_freebsd_fixup(long **stack_base, struct image_params *imgp)
|
||||
elf_freebsd_fixup(register_t **stack_base, struct image_params *imgp)
|
||||
{
|
||||
Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs;
|
||||
long *pos;
|
||||
register_t *pos;
|
||||
|
||||
pos = *stack_base + (imgp->argc + imgp->envc + 2);
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
|
||||
MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments");
|
||||
|
||||
static long *exec_copyout_strings __P((struct image_params *));
|
||||
static register_t *exec_copyout_strings __P((struct image_params *));
|
||||
|
||||
static long ps_strings = PS_STRINGS;
|
||||
SYSCTL_LONG(_kern, KERN_PS_STRINGS, ps_strings, CTLFLAG_RD, &ps_strings, "");
|
||||
@ -103,7 +103,7 @@ execve(p, uap)
|
||||
register struct execve_args *uap;
|
||||
{
|
||||
struct nameidata nd, *ndp;
|
||||
long *stack_base;
|
||||
register_t *stack_base;
|
||||
int error, len, i;
|
||||
struct image_params image_params, *imgp;
|
||||
struct vattr attr;
|
||||
@ -567,14 +567,14 @@ exec_extract_strings(imgp)
|
||||
* new arg and env vector tables. Return a pointer to the base
|
||||
* so that it can be used as the initial stack pointer.
|
||||
*/
|
||||
long *
|
||||
register_t *
|
||||
exec_copyout_strings(imgp)
|
||||
struct image_params *imgp;
|
||||
{
|
||||
int argc, envc;
|
||||
char **vectp;
|
||||
char *stringp, *destp;
|
||||
long *stack_base;
|
||||
register_t *stack_base;
|
||||
struct ps_strings *arginfo;
|
||||
int szsigcode;
|
||||
|
||||
@ -617,7 +617,7 @@ exec_copyout_strings(imgp)
|
||||
/*
|
||||
* vectp also becomes our initial stack base
|
||||
*/
|
||||
stack_base = (long *)vectp;
|
||||
stack_base = (register_t *)vectp;
|
||||
|
||||
stringp = imgp->stringbase;
|
||||
argc = imgp->argc;
|
||||
|
Loading…
Reference in New Issue
Block a user