From nobody Mon Dec 06 18:48:25 2021 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 6806918B5C1D; Mon, 6 Dec 2021 18:48:27 +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 4J7CB21B3bz4SMC; Mon, 6 Dec 2021 18:48:26 +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 9B6B01158B; Mon, 6 Dec 2021 18:48:25 +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 1B6ImPvI065252; Mon, 6 Dec 2021 18:48:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6ImP3D065251; Mon, 6 Dec 2021 18:48:25 GMT (envelope-from git) Date: Mon, 6 Dec 2021 18:48:25 GMT Message-Id: <202112061848.1B6ImP3D065251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: eb029587481e - main - 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/main X-Git-Reftype: branch X-Git-Commit: eb029587481e8d6f610eb31d7f50d34b9240f2f2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638816506; 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=jGxNR4IuhcqyNWlM+ODmfZLlA4uPMnu8Xkmjv8BGpGc=; b=bpL80yDwzlgmGDX5G6dTtQZL606NY4qVsPJh+HoyiptKUH/bCX6kt+dz8nDcHkXonGhke4 TPx8MgGjTfQAVTe93kSYgJG51i9+vXCici4FV0jaxIIlJGQDssrJrDfROok+5V3S0jqCn3 KsSHP9XNFLCg5g95lXtSYCbEBa49neYIx0S+Me//o/y8umq/VjjuvdFvCBB5+5KAB9jPAN RtABTdCxZviJYB6L1GCgF3u/cNMI7KwCwzmfWBaWQie//5RC8Ek02aO9IKVTPOd2tKZAQ/ KwzW+i1fX13oxbArdCx+CwHCkQVzvU97LpnrR6cBFSO+5adUfRVG3NTksabK7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638816506; a=rsa-sha256; cv=none; b=uw2fJVez8YrqEwCABwf4TQyxsw8eQ3yBH+gMjbQeEHSnO9YdOHKjWmmyXLci1bka03Po3p UMansIK3GzdmjAhKSyZpyuCLcxILYjMKOgSgqNR4X1islvzHwr8ckUX3d/FWQl1tRIXq56 TRzi6kuST6DG7N479ODY7nXDgx8+yeyB94bYgteTqoC2aQ24WrXso/9dP5KEJCUgIOFJcQ rIEQcRGAtIio62focJA9acS9CmYI3yWXuKJinx/5E8BOs2VoK8mWFeNyMGa1JFjYtor1xT 668GhhRqFkRLE7+Ooy2CttWct0x5DtlyJJ9ip0Uf9bn+kwOA8d/v5BSkB0c/lw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eb029587481e8d6f610eb31d7f50d34b9240f2f2 commit eb029587481e8d6f610eb31d7f50d34b9240f2f2 Author: Konstantin Belousov AuthorDate: 2021-11-25 01:31:27 +0000 Commit: Konstantin Belousov 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);