rtld direct exec: add option to ignore LD_ variables

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2021-05-29 02:59:07 +03:00
parent e0fa04e257
commit d81f999ac2
2 changed files with 12 additions and 1 deletions

View File

@ -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 -

View File

@ -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;
} else if (opt == 'v') {
machine[0] = '\0';
mib[0] = CTL_HW;
@ -5863,6 +5865,7 @@ print_usage(const char *argv0)
" -b <exe> Execute <exe> instead of <binary>, arg0 is <binary>\n"
" -f <FD> Execute <FD> instead of searching for <binary>\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"
" <binary> Name of process to execute\n"