Skip to contentSkip to conversation

execve syscall fix

PATCH In review Magnus Damm 3 participants 3 messages Nov 29, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 execve syscall fix

Hi everyone,

The execve syscall currently fails on sh4 with -EFAULT. I tracked it down to what looks like a generic problem. This patch makes sure that the two variables "guest_argp" and "guest_envp" are set to "arg2" and "arg3" instead of the old NULL values from previous get_user_ual() calls.

Execve now works as expected on sh4 with this fix. Please apply.

/ magnus

linux-user/syscall.c +2 -0
@@ -3206,6 +3206,7 @@ abi_long do_syscall(void *cpu_env, int n
             argp = alloca((argc + 1) * sizeof(void *));
             envp = alloca((envc + 1) * sizeof(void *));
 
+            guest_argp = arg2;
             for (gp = guest_argp, q = argp; ;
                   gp += sizeof(abi_ulong), q++) {
                 if (get_user_ual(addr, gp))
@@ -3217,6 +3218,7 @@ abi_long do_syscall(void *cpu_env, int n
             }
             *q = NULL;
 
+            guest_envp = arg3;
             for (gp = guest_envp, q = envp; ;
                   gp += sizeof(abi_ulong), q++) {
                 if (get_user_ual(addr, gp))
#1 lore raw
Quoted 9 lines · Magnus Damm

Hi everyone,

The execve syscall currently fails on sh4 with -EFAULT. I tracked it down to what looks like a generic problem. This patch makes sure that the two variables "guest_argp" and "guest_envp" are set to "arg2" and "arg3" instead of the old NULL values from previous get_user_ual() calls.

Execve now works as expected on sh4 with this fix. Please apply.

I have already post fix for this bug. No responce yet.

http://lists.gnu.org/archive/html/qemu-devel/2007-11/msg00612.html

Signature · 4 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + Velesys LLC, http://www.velesys.com/
 + ALT Linux Team, http://www.altlinux.com/
#2 lore raw
In reply to Magnus Damm
Quoted 11 lines · Magnus Damm

Hi everyone,

The execve syscall currently fails on sh4 with -EFAULT. I tracked it down to what looks like a generic problem. This patch makes sure that the two variables "guest_argp" and "guest_envp" are set to "arg2" and "arg3" instead of the old NULL values from previous get_user_ual() calls.

Execve now works as expected on sh4 with this fix. Please apply.

/ magnus

I have already post fix for this bug. No responce yet.

http://lists.gnu.org/archive/html/qemu-devel/2007-11/msg00612.html

Signature · 4 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + Velesys LLC, http://www.velesys.com/
 + ALT Linux Team, http://www.altlinux.com/