]> TLD Linux GIT Repositories - packages/qemu.git/blobdiff - qemu-execve.patch
- updated to 8.0.3, sync with PLD spec changes
[packages/qemu.git] / qemu-execve.patch
diff --git a/qemu-execve.patch b/qemu-execve.patch
new file mode 100644 (file)
index 0000000..03b0931
--- /dev/null
@@ -0,0 +1,54 @@
+diff -ur qemu-8.0.3.orig/linux-user/syscall.c qemu-8.0.3/linux-user/syscall.c
+--- qemu-8.0.3.orig/linux-user/syscall.c       2023-07-22 14:27:06.999503109 +0200
++++ qemu-8.0.3/linux-user/syscall.c    2023-07-22 15:21:31.161543522 +0200
+@@ -659,6 +659,7 @@
+ #endif
+ safe_syscall5(int, waitid, idtype_t, idtype, id_t, id, siginfo_t *, infop, \
+               int, options, struct rusage *, rusage)
++safe_syscall3(int, execve, const char *, filename, char **, argv, char **, envp)
+ safe_syscall5(int, execveat, int, dirfd, const char *, filename,
+               char **, argv, char **, envp, int, flags)
+ #if defined(TARGET_NR_select) || defined(TARGET_NR__newselect) || \
+@@ -8388,9 +8389,9 @@
+     return safe_openat(dirfd, path(pathname), flags, mode);
+ }
+-static int do_execveat(CPUArchState *cpu_env, int dirfd,
+-                       abi_long pathname, abi_long guest_argp,
+-                       abi_long guest_envp, int flags)
++static int do_execv(CPUArchState *cpu_env, int dirfd,
++                    abi_long pathname, abi_long guest_argp,
++                    abi_long guest_envp, int flags, bool is_execveat)
+ {
+     int ret;
+     char **argp, **envp;
+@@ -8469,11 +8470,14 @@
+         goto execve_efault;
+     }
++    const char *exe = p;
+     if (is_proc_myself(p, "exe")) {
+-        ret = get_errno(safe_execveat(dirfd, exec_path, argp, envp, flags));
+-    } else {
+-        ret = get_errno(safe_execveat(dirfd, p, argp, envp, flags));
++        exe = exec_path;
+     }
++    ret = is_execveat
++        ? safe_execveat(dirfd, exe, argp, envp, flags)
++        : safe_execve(exe, argp, envp);
++    ret = get_errno(ret);
+     unlock_user(p, pathname, 0);
+@@ -9012,9 +9016,9 @@
+         return ret;
+ #endif
+     case TARGET_NR_execveat:
+-        return do_execveat(cpu_env, arg1, arg2, arg3, arg4, arg5);
++        return do_execv(cpu_env, arg1, arg2, arg3, arg4, arg5, true);
+     case TARGET_NR_execve:
+-        return do_execveat(cpu_env, AT_FDCWD, arg1, arg2, arg3, 0);
++        return do_execv(cpu_env, AT_FDCWD, arg1, arg2, arg3, 0, false);
+     case TARGET_NR_chdir:
+         if (!(p = lock_user_string(arg1)))
+             return -TARGET_EFAULT;