diff options
| author | Yoav Zach <yoav_zach@yahoo.com> | 2004-06-29 05:16:08 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-29 05:16:08 -0700 |
| commit | 191312cc67f5ccc1d0bd1b6f55b5b7dfc9d44f93 (patch) | |
| tree | c351efd702b9fb989978480dbbc70e4dd86abf29 /include | |
| parent | ca1628beddae9a7f7e6b262f045f70dbbd6ca653 (diff) | |
[PATCH] binfmt misc fd passing via ELF aux vector
The proposed patch uses the aux-vector to pass the fd of the open misc
binary to the interpreter, instead of using argv[1] for that purpose.
Previous patch - open_nonreadable_binaries, offered the option of
binfmt_misc opening the binary on behalf of the interpreter. In case
binfmt_misc is requested to do that it would pass the file-descriptor of
the open binary to the interpreter as its second argument (argv[1]). This
method of passing the file descriptor was suspected to be problematic,
since it changes the command line that users expect to see when using tools
such as 'ps' and 'top'.
The proposed patch changes the method of passing the fd of the open binary
to the translator. Instead of passing it as an argument, binfmt_misc will
request the ELF loader to pass it as a new element in the aux-vector that
it prepares on the stack for ELF interpreter. With this patch, argv[1]
will hold the full path to the binary regardless of whether it opened it or
not.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/binfmts.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index b59bacd48b03..d3f220b57b4a 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -35,13 +35,19 @@ struct linux_binprm{ char * interp; /* Name of the binary really executed. Most of the time same as filename, but could be different for binfmt_{misc,script} */ - unsigned long interp_flags; + unsigned interp_flags; + unsigned interp_data; unsigned long loader, exec; }; #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 #define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) +/* fd of the binary should be passed to the interpreter */ +#define BINPRM_FLAGS_EXECFD_BIT 1 +#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) + + /* * This structure defines the functions that are used to load the binary formats that * linux accepts. |
