git: eb029587481e - main - Add kern.elf{32,64}.vdso knobs to enable/disable vdso preloading
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Dec 2021 18:48:25 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eb029587481e8d6f610eb31d7f50d34b9240f2f2 commit eb029587481e8d6f610eb31d7f50d34b9240f2f2 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-11-25 01:31:27 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-12-06 18:46:49 +0000 Add kern.elf{32,64}.vdso knobs to enable/disable vdso preloading Reviewed by: emaste Discussed with: jrtc27 Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D32960 --- sys/kern/imgact_elf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 4c9a7a40b3b5..f2c39e12a35f 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -129,6 +129,15 @@ SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, nxstack, CTLFLAG_RW, &__elfN(nxstack), 0, __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable stack"); +#if defined(__amd64__) +static int __elfN(vdso) = 1; +SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, + vdso, CTLFLAG_RWTUN, &__elfN(vdso), 0, + __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable vdso preloading"); +#else +static int __elfN(vdso) = 0; +#endif + #if __ELF_WORD_SIZE == 32 && (defined(__amd64__) || defined(__i386__)) int i386_read_exec = 0; SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_RW, &i386_read_exec, 0, @@ -1414,7 +1423,7 @@ __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) + if (imgp->sysent->sv_vdso_base != 0 && __elfN(vdso) != 0) AUXARGS_ENTRY(pos, AT_KPRELOAD, imgp->sysent->sv_vdso_base); AUXARGS_ENTRY(pos, AT_NULL, 0);