From owner-dev-commits-src-main@freebsd.org Wed Jun 2 21:00:29 2021 Return-Path: Delivered-To: dev-commits-src-main@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 616BF64B8E5; Wed, 2 Jun 2021 21:00:29 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FwLyh1chTz4n1X; Wed, 2 Jun 2021 21:00:28 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f47.google.com with SMTP id k25so381903eja.9; Wed, 02 Jun 2021 14:00:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1vla06XCedsm1nJ1NNIYiDfaKXKtc+eVbmuLmwG3w2Y=; b=An+jeliY2aezifeVCGXv9M9x8SCHY+xmV0GxQIP0HE/EW4Xj3JeYmXsDLvuVkJVxCO lNOL4V9a9ssvmJZFhr7v6BvPxbzGwQGG74zEgwVucF8XcSyNZjn3tvrBhCMAjIXtU3Qj ++OW1nUJyR9XtYawOmN838mGT5i240Nbc5PbdJ2lgBCwYwQm/KWL5AzzkFY9fSfsT7+7 GwyvXwa3L1WYX9nAdMRHuL2h0N4ewBb0wtnmrmpaMU4/B8/CW6GO38QKW4GBjPPkKXYB PWVkOnK4HqTPXHHpFDuTD7tgtqZB9QtVosNctS2ETsee6ptvfE9xg9yrfV1NVGRxn8b9 2+ig== X-Gm-Message-State: AOAM530wekRlfDXTEAjMpl61fNYxJ+R+f22DCPpwZluaYHD9QZYZXiB7 qGDhqUmsT0+kc6SFSVFFvUpTcjKi7GjiBg== X-Google-Smtp-Source: ABdhPJz8xPnRLsUdgqE1bN4P/zxRDbCKzlHDaYjrsMhySdf+qq2JSM1e1httUGX9XXHX1DUMbAhKTg== X-Received: by 2002:a17:906:f111:: with SMTP id gv17mr19477577ejb.435.1622667625459; Wed, 02 Jun 2021 14:00:25 -0700 (PDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com. [209.85.128.48]) by smtp.gmail.com with ESMTPSA id ho32sm485156ejc.82.2021.06.02.14.00.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 14:00:25 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id m18so2143303wmq.0; Wed, 02 Jun 2021 14:00:25 -0700 (PDT) X-Received: by 2002:a7b:c042:: with SMTP id u2mr33195429wmc.127.1622667624826; Wed, 02 Jun 2021 14:00:24 -0700 (PDT) MIME-Version: 1.0 References: <202105291459.14TExadZ056959@gitrepo.freebsd.org> In-Reply-To: <202105291459.14TExadZ056959@gitrepo.freebsd.org> From: Alexander Richardson Date: Wed, 2 Jun 2021 22:00:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d81f999ac223 - main - rtld direct exec: add option to ignore LD_ variables To: Konstantin Belousov Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FwLyh1chTz4n1X X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of arichardsonkde@gmail.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=arichardsonkde@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[arichardson@freebsd.org,arichardsonkde@gmail.com]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.218.47:from]; SPAMHAUS_ZRD(0.00)[209.85.218.47:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[209.85.218.47:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.218.47:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 21:00:29 -0000 On Sat, 29 May 2021 at 15:59, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d81f999ac22342789f2b3e21206d83d410be4df3 > > commit d81f999ac22342789f2b3e21206d83d410be4df3 > Author: Konstantin Belousov > AuthorDate: 2021-05-28 23:59:07 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-05-29 14:59:09 +0000 > > rtld direct exec: add option to ignore LD_ variables > > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > --- > 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 7f633ce0b486..16466c7a853e 100644 > --- a/libexec/rtld-elf/rtld.1 > +++ b/libexec/rtld-elf/rtld.1 > @@ -28,7 +28,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd March 24, 2021 > +.Dd May 29, 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, > @@ -313,6 +314,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 > @@ -353,6 +356,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 75c502e8cc85..a517de83b8f5 100644 > --- a/libexec/rtld-elf/rtld.c > +++ b/libexec/rtld-elf/rtld.c > @@ -5793,6 +5793,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; Hi, In CheriBSD I used the -t flag to set ld_tracing = "yes" (we used this in ldd). I've been meaning to submit this as a review, but haven't got around to it yet. How do you feel about using "-u" for "untrusted" or "-i" for "ignore" here instead of "-t"? Thanks, Alex > } else if (opt == 'v') { > machine[0] = '\0'; > mib[0] = CTL_HW; > @@ -5863,6 +5865,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"