linux-user: Adjust child_tidptr on set_tid_address() syscall
PATCH 1/1 linux-user: Adjust child_tidptr on set_tid_address() syscall
Keep track of the new child tidptr given by a set_tid_address() syscall.
Signed-off-by Helge Deller <[email protected]>
linux-user/syscall.c +5 -1
@@ -12202,7 +12202,11 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,#if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)case TARGET_NR_set_tid_address: -return get_errno (set_tid_address ((int *)g2h (cpu, arg1))); + { +TaskState *ts = cpu->opaque; + ts->child_tidptr = arg1; +return get_errno (set_tid_address ((int *)g2h (cpu, ts->child_tidptr))); + }#endif case TARGET_NR_tkill:
I think the previous patch was wrong, since we just emulate writing to child_tidptr. Below is updated RFC patch.
---
[PATCH] linux-user: Adjust child_tidptr on set_tid_address()
Keep track of the new child tidptr given by a set_tid_address() syscall.
Signed-off-by Helge Deller <[email protected]>
linux-user/syscall.c +7 -5
@@ -320,9 +320,6 @@ _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)#ifdef __NR_exit_group _syscall1(int,exit_group,int,error_code)#endif -#if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address) -_syscall1(int,set_tid_address,int *,tidptr) -#endif #if defined(__NR_futex) _syscall6(int,sys_futex,int *,uaddr,int,op,int,val, const struct timespec *,timeout,int *,uaddr2,int,val3)
@@ -12200,9 +12197,14 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, }#endif -#if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address) +#if defined(TARGET_NR_set_tid_address)case TARGET_NR_set_tid_address: -return get_errno (set_tid_address ((int *)g2h (cpu, arg1))); + { +TaskState *ts = cpu->opaque; + ts->child_tidptr = arg1; +/* do not call host set_tid_address() syscall, instead return tid() */ +return get_errno (sys_gettid ()); + }#endif case TARGET_NR_tkill:
Richard Henderson
Reviewed-byQuoted 9 lines · Helge Deller
I think the previous patch was wrong, since we just emulate writing to
child_tidptr. Below is updated RFC patch.---
[PATCH] linux-user: Adjustchild_tidptronset_tid_address()Keep track of the new child tidptr given by a
set_tid_address()syscall.Signed-off-by Helge Deller<[email protected]>
Reviewed-by Richard Henderson <[email protected]>
r~