mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-04 15:13:58 +01:00
HBSD: Revert "Add AT_USRSTACK{BASE, LIM} AT vectors, and ELF_BSDF_VMNOOVERCOMMIT flag"
This reverts commit ff41239f58
. The way
HardenedBSD calculates usrstack is at odds with how FreeBSD calculates
AT_USRSTACK{BASE, LIM}.
FreeBSD introduced AT_USRSTACK{BASE, LIM} in order to save a few
syscalls on libthr and rtld startup. While syscalls are expensive, I
believe it is acceptable for now.
Signed-off-by: Shawn Webb <shawn.webb@hardenedbsd.org>
This commit is contained in:
parent
4e2cdcd284
commit
fc4d195f59
@ -1448,8 +1448,7 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base)
|
||||
Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs;
|
||||
Elf_Auxinfo *argarray, *pos;
|
||||
struct vmspace *vmspace;
|
||||
rlim_t stacksz;
|
||||
int error, bsdflags, oc;
|
||||
int error;
|
||||
|
||||
argarray = pos = malloc(AT_COUNT * sizeof(*pos), M_TEMP,
|
||||
M_WAITOK | M_ZERO);
|
||||
@ -1490,12 +1489,8 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base)
|
||||
AUXARGS_ENTRY(pos, AT_HWCAP, *imgp->sysent->sv_hwcap);
|
||||
if (imgp->sysent->sv_hwcap2 != NULL)
|
||||
AUXARGS_ENTRY(pos, AT_HWCAP2, *imgp->sysent->sv_hwcap2);
|
||||
bsdflags = 0;
|
||||
bsdflags |= __elfN(sigfastblock) ? ELF_BSDF_SIGFASTBLK : 0;
|
||||
oc = atomic_load_int(&vm_overcommit);
|
||||
bsdflags |= (oc & (SWAP_RESERVE_FORCE_ON | SWAP_RESERVE_RLIMIT_ON)) !=
|
||||
0 ? ELF_BSDF_VMNOOVERCOMMIT : 0;
|
||||
AUXARGS_ENTRY(pos, AT_BSDFLAGS, bsdflags);
|
||||
AUXARGS_ENTRY(pos, AT_BSDFLAGS, __elfN(sigfastblock) ?
|
||||
ELF_BSDF_SIGFASTBLK : 0);
|
||||
AUXARGS_ENTRY(pos, AT_ARGC, imgp->args->argc);
|
||||
AUXARGS_ENTRY_PTR(pos, AT_ARGV, imgp->argv);
|
||||
AUXARGS_ENTRY(pos, AT_ENVC, imgp->args->envc);
|
||||
@ -1511,9 +1506,6 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base)
|
||||
AUXARGS_ENTRY(pos, AT_KPRELOAD,
|
||||
vmspace->vm_shp_base + imgp->sysent->sv_vdso_offset);
|
||||
}
|
||||
AUXARGS_ENTRY(pos, AT_USRSTACKBASE, round_page(vmspace->vm_stacktop));
|
||||
stacksz = imgp->proc->p_limit->pl_rlimit[RLIMIT_STACK].rlim_cur;
|
||||
AUXARGS_ENTRY(pos, AT_USRSTACKLIM, stacksz);
|
||||
AUXARGS_ENTRY(pos, AT_NULL, 0);
|
||||
|
||||
free(imgp->auxargs, M_TEMP);
|
||||
|
@ -986,10 +986,8 @@ typedef struct {
|
||||
#define AT_PS_STRINGS 32 /* struct ps_strings */
|
||||
#define AT_FXRNG 33 /* Pointer to root RNG seed version. */
|
||||
#define AT_KPRELOAD 34 /* Base of vdso, preloaded by rtld */
|
||||
#define AT_USRSTACKBASE 35 /* Top of user stack */
|
||||
#define AT_USRSTACKLIM 36 /* Grow limit of user stack */
|
||||
|
||||
#define AT_COUNT 37 /* Count of defined aux entry types. */
|
||||
#define AT_COUNT 35 /* Count of defined aux entry types. */
|
||||
|
||||
/*
|
||||
* Relocation types.
|
||||
@ -1503,6 +1501,5 @@ typedef struct {
|
||||
#define R_X86_64_REX_GOTPCRELX 42
|
||||
|
||||
#define ELF_BSDF_SIGFASTBLK 0x0001 /* Kernel supports fast sigblock */
|
||||
#define ELF_BSDF_VMNOOVERCOMMIT 0x0002
|
||||
|
||||
#endif /* !_SYS_ELF_COMMON_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user