From owner-dev-commits-src-branches@freebsd.org Fri Jun 4 00:44:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E43BB64439A; Fri, 4 Jun 2021 00:44:26 +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 4Fx3tf67rLz3Hhm; Fri, 4 Jun 2021 00:44: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 BACBE13D95; Fri, 4 Jun 2021 00:44:26 +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 1540iQAN020530; Fri, 4 Jun 2021 00:44:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1540iQk9020529; Fri, 4 Jun 2021 00:44:26 GMT (envelope-from git) Date: Fri, 4 Jun 2021 00:44:26 GMT Message-Id: <202106040044.1540iQk9020529@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: 99e1896f20a3 - stable/13 - rtld direct exec: add option to ignore LD_ variables 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: 99e1896f20a3d7702aedc00c1220bdac12d1580a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 00:44:27 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=99e1896f20a3d7702aedc00c1220bdac12d1580a commit 99e1896f20a3d7702aedc00c1220bdac12d1580a Author: Konstantin Belousov AuthorDate: 2021-05-28 23:59:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-04 00:32:50 +0000 rtld direct exec: add option to ignore LD_ variables (cherry picked from commit d81f999ac22342789f2b3e21206d83d410be4df3) --- libexec/rtld-elf/rtld.1 | 10 +++++++++- libexec/rtld-elf/rtld.c | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 index 47bdc028b22d..522382d24b16 100644 --- a/libexec/rtld-elf/rtld.1 +++ b/libexec/rtld-elf/rtld.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 1, 2020 +.Dd March 24, 2021 .Dt RTLD 1 .Os .Sh NAME @@ -131,6 +131,7 @@ all the environment variables listed below, but is being prefixed with .Ev LD_32_ , for example: .Ev LD_32_TRACE_LOADED_OBJECTS . +If the activated image is setuid or setgid, the variables are ignored. .Bl -tag -width ".Ev LD_LIBMAP_DISABLE" .It Ev LD_DUMP_REL_POST If set, @@ -305,6 +306,8 @@ The syntax of the direct invocation is .Op Fl b Ar exe .Op Fl f Ar fd .Op Fl p +.Op Fl t +.Op Fl v .Op Fl - .Pa image_path .Op Ar image arguments @@ -345,6 +348,11 @@ character, uses the search path provided by the environment variable .Dv PATH to find the binary to execute. +.It Fl t +Ignore all +.Ev LD_ +environment variables that otherwise affect the dynamic +linker behavior. .It Fl v Display information about this run-time linker binary, then exit. .It Fl - diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 2943c1d06fa3..ae74f7b9a543 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5773,6 +5773,8 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, break; } else if (opt == 'p') { *use_pathp = true; + } else if (opt == 't') { + trust = false; } else if (opt == 'v') { machine[0] = '\0'; mib[0] = CTL_HW; @@ -5843,6 +5845,7 @@ print_usage(const char *argv0) " -b Execute instead of , arg0 is \n" " -f Execute instead of searching for \n" " -p Search in PATH for named binary\n" + " -t Ignore LD_ environment variables\n" " -v Display identification information\n" " -- End of RTLD options\n" " Name of process to execute\n"