From nobody Sun Jan 02 19:08:16 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 99695191F4C9; Sun, 2 Jan 2022 19:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JRpLS6bnhz4YBQ; Sun, 2 Jan 2022 19:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89DA117528; Sun, 2 Jan 2022 19:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 202J8GOb057844; Sun, 2 Jan 2022 19:08:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 202J8GVX057843; Sun, 2 Jan 2022 19:08:16 GMT (envelope-from git) Date: Sun, 2 Jan 2022 19:08:16 GMT Message-Id: <202201021908.202J8GVX057843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e163ee6ef5b6 - stable/13 - Add kern.elf{32,64}.vdso knobs to enable/disable vdso preloading List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e163ee6ef5b65ec4ae584095ecdff22314613a7f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641150497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gVy7b/QKmjlyErOdpg2f4rRL5S4bCUH5jujuP/kwfqc=; b=IYLidYwLbZJSHsV3lKXarl+5TmcVEZSpp8rNcfu+4sr1U7PODnrF4I7Xndkdk7v6YsfjRr 7S1xDGxY25bL9gnYlZeP9M8ji7SxlzBlx47JE4sTjOtCesuP+W7p0YspbxolJxGFF08EMp kg64Q+7yhbJ4HfW0mEUmNqKaywQAfb0MmnUMs0OH3TAn3a9QP8YBJTfg+3vsN6WjrCkknF 8JwglbFjoVOR4tBorMNA+RVyHkXE8TwegKMCrDZVNRfgZGjnIbHi6ZBiG/HgLM6eXOqGzg TtQi+VKmyBCXpCqeVwHYEQo6hu2QJhylp4mBIFzZhLshhEpB2Hiy/+YN8j5tVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641150497; a=rsa-sha256; cv=none; b=OkKxC71vXbWtb+2R7iNJRCuBmnCX94g7zQZ8zvJtbq/sjXJeCuR/dc8R3xlt5rjAONI9xo HCjV0OF9pfSnqSEAPU2AJ5z5fwh1PoWkRTUbS2KepQc2JY8KdlNOGeRwZxGJBxnGvhzo1J 2f4vAlSRmR4b8AngtvYaeRELVylzYpSK1AZypwWw1CE6GKEI5PGsvb/V8lPjZdtCu0I/Yk 9ffTnv7RrhB6+35tv7aHSoettCUBGX4O2BbDbChZFelO6qP8PHzr5dDREi1ve6/jHdVEbn UYUQ6BrfwTIcuJM2nIZl6RmRu1zvXKz1Xlne0yuKoaZbi9ix1uSR2VMeWiUWTA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e163ee6ef5b65ec4ae584095ecdff22314613a7f commit e163ee6ef5b65ec4ae584095ecdff22314613a7f Author: Konstantin Belousov AuthorDate: 2021-11-25 01:31:27 +0000 Commit: Konstantin Belousov 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);