From owner-freebsd-current@freebsd.org Fri Dec 20 22:02:28 2019 Return-Path: Delivered-To: freebsd-current@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 7AE771E4E4B for ; Fri, 20 Dec 2019 22:02:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47fjQq1qspz4Tnv for ; Fri, 20 Dec 2019 22:02:27 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f51.google.com with SMTP id r27so13601820otc.8 for ; Fri, 20 Dec 2019 14:02:27 -0800 (PST) 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:reply-to :from:date:message-id:subject:to:cc; bh=J4aOQR6QG2EhfqBGsPhrp7y6uHrwfySE9NhYuhi00kE=; b=uL09JIsqD7Cop+a2pJgjDE3Nd+lK4jfQeywbdVxlkmG3uFZ/ZE0bHY2KJ+SxWRu4i7 9DNBu+JJ2S4e1Zx4m9jYfj68wd9cOzd6hcqDKrFFBd0Csfrs3HxeA9e+S+yD15PHbuTn OY7RN8hihTiajSukZjM20jJpjo5x1zY+JGGX1o2iOz6qLYPozQymtN0CtEFvxG03TpH3 iU8NQNe3TfJ2n9XcsAS3gki0NQ2lcwXD165UrEQAQKS058WYCvvCr2hEZM9mVghuH4IJ 08QowYGc6PvuD0SUfF7vz1DwLGnsh8WXHcsU0wkkA8IliaOXCt75Onpk6hUM7aRJl54x RFqQ== X-Gm-Message-State: APjAAAW7VBkyCpcyszqWdehOiLL+TW93rPDNFTe6uPL9xBKaXzLuYfVY GT0fBbM2O5qkirGL6SVh5JPXF5tx X-Google-Smtp-Source: APXvYqx49o0nUVoaibepTOZEvR0RiPIKBdAd5aoFkbaeM6Y9W4cLczBq6YfiJMSNakyTA24OseOJPA== X-Received: by 2002:a9d:6e98:: with SMTP id a24mr4127334otr.109.1576879345750; Fri, 20 Dec 2019 14:02:25 -0800 (PST) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com. [209.85.167.175]) by smtp.gmail.com with ESMTPSA id v200sm3630099oie.35.2019.12.20.14.02.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Dec 2019 14:02:25 -0800 (PST) Received: by mail-oi1-f175.google.com with SMTP id c77so4977463oib.7 for ; Fri, 20 Dec 2019 14:02:25 -0800 (PST) X-Received: by 2002:aca:90a:: with SMTP id 10mr4870591oij.81.1576879345372; Fri, 20 Dec 2019 14:02:25 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 20 Dec 2019 14:02:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: AT_EXECPATH aux_info vector contains path of interpreter when directly exec'ing rtld To: Ryan Stone Cc: FreeBSD Current X-Rspamd-Queue-Id: 47fjQq1qspz4Tnv X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.210.51 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-3.24 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[51.210.85.209.rep.mailspike.net : 127.0.0.18]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[51.210.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.24)[ip: (-1.13), ipnet: 209.85.128.0/17(-3.11), asn: 15169(-1.89), country: US(-0.05)]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Dec 2019 22:02:28 -0000 Isn=E2=80=99t rtld=E2=80=99s behavior here correct? It=E2=80=99s really Cla= ng which is doing something quite odd. On Fri, Dec 20, 2019 at 13:27 Ryan Stone wrote: > I've noticed that on head, if I directly execute rtld to run an > executable, AT_EXECPATH contains the path to rtld on head (on > 12.0-RELEASE it will contain nothing). This is causing me a problem > because clang uses AT_EXECPATH to preferentially locate where it's > installed, which it uses to locate its driver programs. > > The end result is that clang can no longer successfully be executed > from a process in capability mode, whereas before I could fexecve rtld > and give it a pre-opened file descriptor to /usr/bin/clang. > > I've put together a quick test program demonstrating the problem: > > https://people.freebsd.org/~rstone/getprogname.c > > On 12.0-RELEASE, directly executing rtld to run this program gives this > output: > $ /libexec/ld-elf.so.1 -- ./progname > progname: progname > argv[0]: ./progname > elf_aux_info failed: No such file or directory > > On head, I get this instead: > /libexec/ld-elf.so.1 -- ./progname > progname: progname > argv[0]: ./progname > AT_EXECPATH: /libexec/ld-elf.so.1 > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org= " >