summaryrefslogtreecommitdiffstats
path: root/linux-user
diff options
context:
space:
mode:
authorLaurent Vivier2022-09-27 14:43:56 +0200
committerLaurent Vivier2022-10-21 17:46:19 +0200
commitf07eb1c4f805c0dcc14dd69fee49b601ce0b2d2c (patch)
treeb14eada29e2a65b574b6294c1f1c42543c4a9713 /linux-user
parentlinux-user: fix pidfd_send_signal() (diff)
downloadqemu-f07eb1c4f805c0dcc14dd69fee49b601ce0b2d2c.tar.gz
qemu-f07eb1c4f805c0dcc14dd69fee49b601ce0b2d2c.tar.xz
qemu-f07eb1c4f805c0dcc14dd69fee49b601ce0b2d2c.zip
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>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ad06ec7bd5..a7a29091c9 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -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
* 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);
goto execve_end;