]> TLD Linux GIT Repositories - packages/qemu.git/blobdiff - qemu-user-execve.patch
- updated to 7.2.0
[packages/qemu.git] / qemu-user-execve.patch
index 7fc709c0cc3d76bc680bfd50bd4e51a74916dead..4faf7359d475e817c9d654cd2862ad58c1c07e85 100644 (file)
@@ -45,18 +45,18 @@ Reviewed-by: Laurent Vivier <laurent@vivier.eu>
 v3 changes:
        - rebase the patchset against current code
 
-diff -urNpa qemu-6.2.0.orig/linux-user/main.c qemu-6.2.0/linux-user/main.c
---- qemu-6.2.0.orig/linux-user/main.c  2022-01-23 13:51:24.451951509 +0100
-+++ qemu-6.2.0/linux-user/main.c       2022-01-23 13:53:07.574160010 +0100
-@@ -119,6 +119,7 @@ static void usage(int exitcode);
+diff -urNpa qemu-7.2.0.orig/linux-user/main.c qemu-7.2.0/linux-user/main.c
+--- qemu-7.2.0.orig/linux-user/main.c  2023-02-08 21:23:07.149156085 +0100
++++ qemu-7.2.0/linux-user/main.c       2023-02-08 21:23:36.695149312 +0100
+@@ -123,6 +123,7 @@ static void usage(int exitcode);
  
  static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX;
  const char *qemu_uname_release;
 +const char *qemu_execve_path;
  
+ #if !defined(TARGET_DEFAULT_STACK_SIZE)
  /* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
-    we allocate a bigger stack. Need a better solution, for example
-@@ -338,6 +339,11 @@ static void handle_arg_guest_base(const
+@@ -362,6 +363,11 @@ static void handle_arg_guest_base(const
      have_guest_base = true;
  }
  
@@ -68,7 +68,7 @@ diff -urNpa qemu-6.2.0.orig/linux-user/main.c qemu-6.2.0/linux-user/main.c
  static void handle_arg_reserved_va(const char *arg)
  {
      char *p;
-@@ -440,6 +446,8 @@ static const struct qemu_argument arg_ta
+@@ -464,6 +470,8 @@ static const struct qemu_argument arg_ta
       "uname",      "set qemu uname release string to 'uname'"},
      {"B",          "QEMU_GUEST_BASE",  true,  handle_arg_guest_base,
       "address",    "set guest_base address to 'address'"},
@@ -77,10 +77,10 @@ diff -urNpa qemu-6.2.0.orig/linux-user/main.c qemu-6.2.0/linux-user/main.c
      {"R",          "QEMU_RESERVED_VA", true,  handle_arg_reserved_va,
       "size",       "reserve 'size' bytes for guest virtual address space"},
      {"d",          "QEMU_LOG",         true,  handle_arg_log,
-diff -urNpa qemu-6.2.0.orig/linux-user/syscall.c qemu-6.2.0/linux-user/syscall.c
---- qemu-6.2.0.orig/linux-user/syscall.c       2022-01-23 13:51:24.453951513 +0100
-+++ qemu-6.2.0/linux-user/syscall.c    2022-01-23 13:53:07.576160014 +0100
-@@ -8072,6 +8072,109 @@ static target_timer_t get_timer_id(abi_l
+diff -urNpa qemu-7.2.0.orig/linux-user/syscall.c qemu-7.2.0/linux-user/syscall.c
+--- qemu-7.2.0.orig/linux-user/syscall.c       2023-02-08 21:23:07.150156084 +0100
++++ qemu-7.2.0/linux-user/syscall.c    2023-02-08 21:28:50.327077355 +0100
+@@ -8378,6 +8378,109 @@ static target_timer_t get_timer_id(abi_l
      return timerid;
  }
  
@@ -190,24 +190,30 @@ diff -urNpa qemu-6.2.0.orig/linux-user/syscall.c qemu-6.2.0/linux-user/syscall.c
  static int target_to_host_cpu_mask(unsigned long *host_mask,
                                     size_t host_size,
                                     abi_ulong target_addr,
-@@ -8585,7 +8688,12 @@ static abi_long do_syscall1(void *cpu_en
-              * before the execve completes and makes it the other
+@@ -8933,9 +9036,17 @@ static abi_long do_syscall1(CPUArchState
               * program's problem.
               */
--            ret = get_errno(safe_execve(p, argp, envp));
-+            if (qemu_execve_path && *qemu_execve_path) {
-+                ret = get_errno(qemu_execve(p, argp, envp));
-+            } else {
-+                ret = get_errno(safe_execve(p, argp, envp));
-+            }
-+
+             if (is_proc_myself(p, "exe")) {
+-                ret = get_errno(safe_execve(exec_path, argp, envp));
++                if (qemu_execve_path && *qemu_execve_path) {
++                    ret = get_errno(qemu_execve(exec_path, argp, envp));
++                } else {
++                    ret = get_errno(safe_execve(exec_path, argp, envp));
++                }
+             } else {
+-                ret = get_errno(safe_execve(p, argp, envp));
++                if (qemu_execve_path && *qemu_execve_path) {
++                    ret = get_errno(qemu_execve(p, argp, envp));
++                } else {
++                    ret = get_errno(safe_execve(p, argp, envp));
++                }
+             }
              unlock_user(p, arg1, 0);
  
-             goto execve_end;
-diff -urNpa qemu-6.2.0.orig/linux-user/user-internals.h qemu-6.2.0/linux-user/user-internals.h
---- qemu-6.2.0.orig/linux-user/user-internals.h        2022-01-23 13:51:24.450951507 +0100
-+++ qemu-6.2.0/linux-user/user-internals.h     2022-01-23 13:54:10.373286987 +0100
-@@ -28,6 +28,7 @@ void init_task_state(TaskState *ts);
+diff -urNpa qemu-7.2.0.orig/linux-user/user-internals.h qemu-7.2.0/linux-user/user-internals.h
+--- qemu-7.2.0.orig/linux-user/user-internals.h        2023-02-08 21:23:07.148156085 +0100
++++ qemu-7.2.0/linux-user/user-internals.h     2023-02-08 21:23:36.697149312 +0100
+@@ -27,6 +27,7 @@ void init_task_state(TaskState *ts);
  void task_settid(TaskState *);
  void stop_all_tasks(void);
  extern const char *qemu_uname_release;