mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
linux-user: add support of binfmt_misc 'O' flag
The binfmt_misc module can calculate the credentials and security token according to the binary instead of to the interpreter if the 'C' flag is enabled. To be able to execute non-readable binaries, this flag implies 'O' flag. When 'O' flag is enabled, bintfmt_misc opens the file for reading and pass the file descriptor to the interpreter. References: linux/Documentation/binfmt_misc.txt ['O' and 'C' description] linux/fs/binfmt_misc.c linux/fs/binfmt_elf.c [ AT_EXECFD usage ] Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
parent
0d78b3b5b1
commit
03cfd8faa7
3 changed files with 34 additions and 8 deletions
|
@ -131,7 +131,7 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
|
|||
return sp;
|
||||
}
|
||||
|
||||
int loader_exec(const char * filename, char ** argv, char ** envp,
|
||||
int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
||||
struct target_pt_regs * regs, struct image_info *infop,
|
||||
struct linux_binprm *bprm)
|
||||
{
|
||||
|
@ -140,11 +140,7 @@ int loader_exec(const char * filename, char ** argv, char ** envp,
|
|||
|
||||
bprm->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);
|
||||
memset(bprm->page, 0, sizeof(bprm->page));
|
||||
retval = open(filename, O_RDONLY);
|
||||
if (retval < 0) {
|
||||
return -errno;
|
||||
}
|
||||
bprm->fd = retval;
|
||||
bprm->fd = fdexec;
|
||||
bprm->filename = (char *)filename;
|
||||
bprm->argc = count(argv);
|
||||
bprm->argv = argv;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue