Commit b521c5be authored by Shawn Webb's avatar Shawn Webb
Browse files

HBSD: Randomize the VDSO



Now that I brought in FreeBSD's VDSO support, we need to apply our
PaX-inspired ASLR implementation to it. In similar vein as the
per-process shared page tracking, we now track the base address of the
VDSO on a per-process basis. This allows us to apply our existing VDSO
(shared page, back then) delta to this proper VDSO implementation.

Basic testing has been done. More testing is needed.
Signed-off-by: Shawn Webb's avatarShawn Webb <shawn.webb@hardenedbsd.org>
parent 3ce96981
......@@ -1457,8 +1457,8 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base)
AUXARGS_ENTRY_PTR(pos, AT_PS_STRINGS, imgp->ps_strings);
if (imgp->sysent->sv_fxrng_gen_base != 0)
AUXARGS_ENTRY(pos, AT_FXRNG, imgp->sysent->sv_fxrng_gen_base);
if (imgp->sysent->sv_vdso_base != 0 && __elfN(vdso) != 0)
AUXARGS_ENTRY(pos, AT_KPRELOAD, imgp->sysent->sv_vdso_base);
if (imgp->proc->p_vdso_base != 0 && __elfN(vdso) != 0)
AUXARGS_ENTRY(pos, AT_KPRELOAD, imgp->proc->p_vdso_base);
AUXARGS_ENTRY(pos, AT_NULL, 0);
free(imgp->auxargs, M_TEMP);
......
......@@ -763,8 +763,10 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p,
}
p->p_psstrings = p->p_sysent->sv_psstrings;
p->p_vdso_base = p->p_sysent->sv_vdso_base;
#ifdef PAX_ASLR
pax_aslr_stack_with_gap(p, &(p->p_psstrings));
pax_aslr_vdso(p, &(p->p_vdso_base));
#endif
/*
......
......@@ -716,6 +716,7 @@ struct proc {
vm_offset_t p_timekeep_base; /* (c) Address of timekeep structure. */
vm_offset_t p_shared_page_base; /* (c) Address of shared page. */
vm_offset_t p_sigcode_base; /* (c) Address of sigcode. */
vm_offset_t p_vdso_base;
uint64_t p_elf_flags; /* (x) ELF flags */
void *p_elf_brandinfo; /* (x) Elf_Brandinfo, NULL for
non ELF binaries. */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment