linux(4): Deduplicate linux_fixup_elf().
Use native routines to fixup initial process stack. On Arm64 linux_elf_fixup() is noop, as it do the stack fixup (room for argc) in the linux_copyout_strings(). MFC after: 1 week
This commit is contained in:
parent
cc1b0f7d96
commit
9e550625f8
@ -117,8 +117,6 @@ SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
|
||||
|
||||
static int linux_copyout_strings(struct image_params *imgp,
|
||||
uintptr_t *stack_base);
|
||||
static int linux_fixup_elf(uintptr_t *stack_base,
|
||||
struct image_params *iparams);
|
||||
static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
|
||||
static void linux_vdso_install(const void *param);
|
||||
static void linux_vdso_deinstall(const void *param);
|
||||
@ -270,20 +268,6 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
linux_fixup_elf(uintptr_t *stack_base, struct image_params *imgp)
|
||||
{
|
||||
Elf_Addr *base;
|
||||
|
||||
base = (Elf64_Addr *)*stack_base;
|
||||
base--;
|
||||
if (suword(base, (uint64_t)imgp->args->argc) == -1)
|
||||
return (EFAULT);
|
||||
|
||||
*stack_base = (uintptr_t)base;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy strings out to the new process address space, constructing new arg
|
||||
* and env vector tables. Return a pointer to the base so that it can be used
|
||||
@ -705,7 +689,7 @@ linux_vsyscall(struct thread *td)
|
||||
struct sysentvec elf_linux_sysvec = {
|
||||
.sv_size = LINUX_SYS_MAXSYSCALL,
|
||||
.sv_table = linux_sysent,
|
||||
.sv_fixup = linux_fixup_elf,
|
||||
.sv_fixup = __elfN(freebsd_fixup),
|
||||
.sv_sendsig = linux_rt_sendsig,
|
||||
.sv_sigcode = &_binary_linux_vdso_so_o_start,
|
||||
.sv_szsigcode = &linux_szsigcode,
|
||||
|
@ -118,8 +118,6 @@ extern const char *linux32_syscallnames[];
|
||||
|
||||
SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
|
||||
|
||||
static int linux_fixup_elf(uintptr_t *stack_base,
|
||||
struct image_params *iparams);
|
||||
static int linux_copyout_strings(struct image_params *imgp,
|
||||
uintptr_t *stack_base);
|
||||
static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
|
||||
@ -210,19 +208,6 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
linux_fixup_elf(uintptr_t *stack_base, struct image_params *imgp)
|
||||
{
|
||||
Elf32_Addr *base;
|
||||
|
||||
base = (Elf32_Addr *)*stack_base;
|
||||
base--;
|
||||
if (suword32(base, (uint32_t)imgp->args->argc) == -1)
|
||||
return (EFAULT);
|
||||
*stack_base = (uintptr_t)base;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
|
||||
{
|
||||
@ -858,7 +843,7 @@ linux32_fixlimit(struct rlimit *rl, int which)
|
||||
struct sysentvec elf_linux_sysvec = {
|
||||
.sv_size = LINUX32_SYS_MAXSYSCALL,
|
||||
.sv_table = linux32_sysent,
|
||||
.sv_fixup = linux_fixup_elf,
|
||||
.sv_fixup = elf32_freebsd_fixup,
|
||||
.sv_sendsig = linux_sendsig,
|
||||
.sv_sigcode = &_binary_linux32_vdso_so_o_start,
|
||||
.sv_szsigcode = &linux_szsigcode,
|
||||
|
@ -105,8 +105,6 @@ SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
|
||||
|
||||
static int linux_fixup(uintptr_t *stack_base,
|
||||
struct image_params *iparams);
|
||||
static int linux_fixup_elf(uintptr_t *stack_base,
|
||||
struct image_params *iparams);
|
||||
static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
|
||||
static void linux_exec_setregs(struct thread *td,
|
||||
struct image_params *imgp, uintptr_t stack);
|
||||
@ -203,19 +201,6 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
linux_fixup_elf(uintptr_t *stack_base, struct image_params *imgp)
|
||||
{
|
||||
register_t *base;
|
||||
|
||||
base = (register_t *)*stack_base;
|
||||
base--;
|
||||
if (suword(base, (register_t)imgp->args->argc) == -1)
|
||||
return (EFAULT);
|
||||
*stack_base = (uintptr_t)base;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copied from kern/kern_exec.c
|
||||
*/
|
||||
@ -801,7 +786,7 @@ INIT_SYSENTVEC(aout_sysvec, &linux_sysvec);
|
||||
struct sysentvec elf_linux_sysvec = {
|
||||
.sv_size = LINUX_SYS_MAXSYSCALL,
|
||||
.sv_table = linux_sysent,
|
||||
.sv_fixup = linux_fixup_elf,
|
||||
.sv_fixup = __elfN(freebsd_fixup),
|
||||
.sv_sendsig = linux_sendsig,
|
||||
.sv_sigcode = &_binary_linux_vdso_so_o_start,
|
||||
.sv_szsigcode = &linux_szsigcode,
|
||||
|
Loading…
Reference in New Issue
Block a user