Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2019 16:26:41 -0500
From:      Ryan Stone <rysto32@gmail.com>
To:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   AT_EXECPATH aux_info vector contains path of interpreter when directly exec'ing rtld
Message-ID:  <CAFMmRNzh2qR1bT%2BvLmCMMXgmYGFCDWDU2rAcpace01H8=SAg_A@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFMmRNzh2qR1bT%2BvLmCMMXgmYGFCDWDU2rAcpace01H8=SAg_A>