Page MenuHomeFreeBSD

D19277.id54165.diff
No OneTemporary

D19277.id54165.diff

Index: libexec/rtld-elf/rtld.c
===================================================================
--- libexec/rtld-elf/rtld.c
+++ libexec/rtld-elf/rtld.c
@@ -779,6 +779,11 @@
/* Return the exit procedure and the program entry point. */
*exit_proc = rtld_exit;
*objp = obj_main;
+
+ /* Attach to a jail */
+ if (jid > 0)
+ jail_attach(jid);
+
return (func_ptr_type) obj_main->entry;
}
@@ -1820,6 +1825,7 @@
struct stat hint_stat;
unsigned int SLPndx, hintndx, fndx, fcount;
int fd;
+ int jid;
size_t flen;
uint32_t dl;
bool skip;
@@ -5510,6 +5516,20 @@
}
*fdp = fd;
break;
+ } else if (opt == 'j') {
+ if (j != arglen - 1) {
+ /* -j must be the last option in, e.g., -abcj */
+ _rtld_error("Invalid options: %s", arg);
+ rtld_die();
+ }
+ i++;
+ jid = parse_integer(argv[i]);
+ if (fd == -1) {
+ _rtld_error("Invalid JID: '%s'",
+ argv[i]);
+ rtld_die();
+ }
+ break;
} else if (opt == 'p') {
*use_pathp = true;
} else {
@@ -5554,12 +5574,13 @@
print_usage(const char *argv0)
{
- rtld_printf("Usage: %s [-h] [-f <FD>] [--] <binary> [<args>]\n"
+ rtld_printf("Usage: %s [-h] [-f <FD>] [-j <JID>] [--] <binary> [<args>]\n"
"\n"
"Options:\n"
" -h Display this help message\n"
" -p Search in PATH for named binary\n"
" -f <FD> Execute <FD> instead of searching for <binary>\n"
+ " -j <JID> Execute <binary> after attaching to jail with JID <JID>\n"
" -- End of RTLD options\n"
" <binary> Name of process to execute\n"
" <args> Arguments to the executed process\n", argv0);

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 2, 5:05 AM (6 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30706038
Default Alt Text
D19277.id54165.diff (2 KB)

Event Timeline