git: e163ee6ef5b6 - stable/13 - Add kern.elf{32,64}.vdso knobs to enable/disable vdso preloading
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 02 Jan 2022 19:08:16 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e163ee6ef5b65ec4ae584095ecdff22314613a7f commit e163ee6ef5b65ec4ae584095ecdff22314613a7f Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-11-25 01:31:27 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-01-02 16:43:01 +0000 Add kern.elf{32,64}.vdso knobs to enable/disable vdso preloading (cherry picked from commit eb029587481e8d6f610eb31d7f50d34b9240f2f2) --- 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 c01b9eb7b8a4..721c24af7fe6 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -130,6 +130,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, @@ -1452,7 +1461,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);