Skip to contentSkip to conversation

Revert "Use the host exit syscall for exiting (Lauro Ramos Venancio)."

PATCH In review Felipe Contreras 3 participants 8 messages Mar 7, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "Use the host exit syscall for exiting (Lauro Ramos Venancio)."

This breaks pthread_join on arm-linux-user.

---
 linux-user/syscall.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
linux-user/syscall.c +1 -3
index 40eab4e..572fa0a 100644
@@ -156,7 +156,6 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,	\
 }
 
 
-#define __NR_sys_exit __NR_exit
 #define __NR_sys_uname __NR_uname
 #define __NR_sys_faccessat __NR_faccessat
 #define __NR_sys_fchmodat __NR_fchmodat
@@ -198,7 +197,6 @@ static int gettid(void) {
     return -ENOSYS;
 }
 #endif
-_syscall1(int,sys_exit,int,status)
 _syscall1(int,sys_uname,struct new_utsname *,buf)
 #if defined(TARGET_NR_faccessat) && defined(__NR_faccessat)
 _syscall4(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode,int,flags)
@@ -3433,7 +3431,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
         gdb_exit(cpu_env, arg1);
         /* XXX: should free thread stack and CPU env */
-        sys_exit(arg1);
+        _exit(arg1);
         ret = 0; /* avoid warning */
         break;
     case TARGET_NR_read:
Signature · 1 line
1.6.2
#1 lore raw
Quoted 1 line · Felipe Contreras

This breaks pthread_join on arm-linux-user.

I am not sure the fix is correct. If you run tests/testthread.c you'll notice the thread2 doesn't print the 20 values it should.

BTW it looks like this test doesn't run on i386 and x86_64: it ends immediately.

Laurent

Quoted 39 lines
---
 linux-user/syscall.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
linux-user/syscall.c +1 -4
index 40eab4e..572fa0a 100644
@@ -156,7 +156,6 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,   \
 }
 
 
-#define __NR_sys_exit __NR_exit
 #define __NR_sys_uname __NR_uname
 #define __NR_sys_faccessat __NR_faccessat
 #define __NR_sys_fchmodat __NR_fchmodat
@@ -198,7 +197,6 @@ static int gettid(void) {
    return -ENOSYS;
 }
 #endif
-_syscall1(int,sys_exit,int,status)
 _syscall1(int,sys_uname,struct new_utsname *,buf)
 #if defined(TARGET_NR_faccessat) && defined(__NR_faccessat)
 _syscall4(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode,int,flags)
@@ -3433,7 +3431,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
        gdb_exit(cpu_env, arg1);
        /* XXX: should free thread stack and CPU env */
-        sys_exit(arg1);
+        _exit(arg1);
        ret = 0; /* avoid warning */
        break;
    case TARGET_NR_read:
--

1.6.2

#2 lore raw
In reply to Felipe Contreras

linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 3434

Quoted 5 lines · Felipe Contreras

This breaks pthread_join on arm-linux-user.
..

         /* XXX: should free thread stack and CPU env */
linux-user/syscall.c +1 -1
-        sys_exit(arg1);
+        _exit(arg1);

No. You're just reverting an earlier (also incorrect) change.

Paul

#3 lore raw
Quoted 8 lines · Paul Brook
Quoted 5 lines · Felipe Contreras

This breaks pthread_join on arm-linux-user.
..
         /* XXX: should free thread stack and CPU env */
-        sys_exit(arg1);
+        _exit(arg1);

No. You're just reverting an earlier (also incorrect) change.

That commit introduced a regression arm-linux-user, I'm just reverting the change.

What do you propose? Leaving arm-linux-user broken is not good.

Signature · 1 line
Felipe Contreras
#4 lore raw
Quoted 8 lines · Felipe Contreras
Quoted 7 lines · Paul Brook
Quoted 5 lines · Felipe Contreras

This breaks pthread_join on arm-linux-user.
..
         /* XXX: should free thread stack and CPU env */
-        sys_exit(arg1);
+        _exit(arg1);

Quoted 6 lines
Quoted 1 line

No. You're just reverting an earlier (also incorrect) change.

That commit introduced a regression arm-linux-user, I'm just reverting the change.

What do you propose? Leaving arm-linux-user broken is not good.

It's broken both after your patch, you're just exchanging one bit of brokenness for another. The solution is to fix it properly, like I already did.

Paul

#5 lore raw
Quoted 11 lines · Paul Brook
Quoted 10 lines · Felipe Contreras
Quoted 8 lines · Paul Brook
Quoted 5 lines · Felipe Contreras

This breaks pthread_join on arm-linux-user.
..
         /* XXX: should free thread stack and CPU env */
-        sys_exit(arg1);
+        _exit(arg1);

No. You're just reverting an earlier (also incorrect) change.

Quoted 8 lines
Quoted 4 lines

That commit introduced a regression arm-linux-user, I'm just reverting the change.

What do you propose? Leaving arm-linux-user broken is not good.

It's broken both after your patch, you're just exchanging one bit of brokenness for another. The solution is to fix it properly, like I already did.

Cool, I confirm your patch also fixes the issue.

Thanks.

Signature · 1 line
Felipe Contreras
#6 lore raw
In reply to Felipe Contreras
Quoted 1 line · Felipe Contreras

On Sat, Mar 7, 2009 at 4:05 PM, Paul Brook <[email protected]> wrote:

[...]

Quoted 6 lines
Quoted 1 line

No. You're just reverting an earlier (also incorrect) change.

That commit introduced a regression arm-linux-user, I'm just reverting the change.

What do you propose? Leaving arm-linux-user broken is not good.

Paul's commit 6735 fixes at least testthread for ARM (though it doesn't fix it from i386 and x86_64).

Laurent

#7 lore raw
Quoted 9 lines
Quoted 6 lines
Quoted 1 line

No. You're just reverting an earlier (also incorrect) change.

That commit introduced a regression arm-linux-user, I'm just reverting the change.

What do you propose? Leaving arm-linux-user broken is not good.

Paul's commit 6735 fixes at least testthread for ARM (though it doesn't fix it from i386 and x86_64).

That's because x86/x86-64 doesn't support threads/NPTL at all.

Paul