mirror of
https://github.com/mii443/qemu.git
synced 2025-08-23 15:48:20 +00:00
linux-user: handle /proc/self/exe with execve() syscall
If path is /proc/self/exe, use the executable path provided by exec_path. Don't use execfd as it is closed by loader_exec() and otherwise will survive to the exec() syscall and be usable child process. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220927124357.688536-2-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
@ -8860,7 +8860,11 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
|
|||||||
* before the execve completes and makes it the other
|
* before the execve completes and makes it the other
|
||||||
* program's problem.
|
* program's problem.
|
||||||
*/
|
*/
|
||||||
ret = get_errno(safe_execve(p, argp, envp));
|
if (is_proc_myself(p, "exe")) {
|
||||||
|
ret = get_errno(safe_execve(exec_path, argp, envp));
|
||||||
|
} else {
|
||||||
|
ret = get_errno(safe_execve(p, argp, envp));
|
||||||
|
}
|
||||||
unlock_user(p, arg1, 0);
|
unlock_user(p, arg1, 0);
|
||||||
|
|
||||||
goto execve_end;
|
goto execve_end;
|
||||||
|
Reference in New Issue
Block a user