[5/5] linux-user: update get_thread_area/set_thread_area strace
diff mbox

Message ID 1465417472-11359-6-git-send-email-laurent@vivier.eu
State New
Headers show

Commit Message

Laurent Vivier June 8, 2016, 8:24 p.m. UTC
int get_thread_area(struct user_desc *u_info);
       int set_thread_area(struct user_desc *u_info);

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/strace.list | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peter Maydell June 10, 2016, 1:04 p.m. UTC | #1
On 8 June 2016 at 21:24, Laurent Vivier <laurent@vivier.eu> wrote:
>        int get_thread_area(struct user_desc *u_info);
>        int set_thread_area(struct user_desc *u_info);
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/strace.list | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/strace.list b/linux-user/strace.list
> index 7c54dc6..9c0259c 100644
> --- a/linux-user/strace.list
> +++ b/linux-user/strace.list
> @@ -337,7 +337,7 @@
>  { TARGET_NR_getsockopt, "getsockopt" , NULL, NULL, NULL },
>  #endif
>  #ifdef TARGET_NR_get_thread_area
> -{ TARGET_NR_get_thread_area, "get_thread_area" , NULL, NULL, NULL },
> +{ TARGET_NR_get_thread_area, "get_thread_area", "%s(%p)", NULL, NULL },
>  #endif
>  #ifdef TARGET_NR_gettid
>  { TARGET_NR_gettid, "gettid" , NULL, NULL, NULL },
> @@ -1234,7 +1234,7 @@
>  { TARGET_NR_setsockopt, "setsockopt" , NULL, NULL, NULL },
>  #endif
>  #ifdef TARGET_NR_set_thread_area
> -{ TARGET_NR_set_thread_area, "set_thread_area" , NULL, NULL, NULL },
> +{ TARGET_NR_set_thread_area, "set_thread_area", "%s(%p)", NULL, NULL },
>  #endif
>  #ifdef TARGET_NR_set_tid_address
>  { TARGET_NR_set_tid_address, "set_tid_address" , NULL, NULL, NULL },

The problem with this is that %p is a format string for a host pointer,
but the argument we pass to gemu_log() in print_syscall() is an abi_long.
If host pointers are 64 bit but abi_long is 32 bit this is going to do
the wrong thing.

This is a bug present in some of our current format strings, but
we should probably not add to it. I think TARGET_ABI_FMT_lx should
do what you want?

thanks
-- PMM

Patch
diff mbox

diff --git a/linux-user/strace.list b/linux-user/strace.list
index 7c54dc6..9c0259c 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -337,7 +337,7 @@ 
 { TARGET_NR_getsockopt, "getsockopt" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_get_thread_area
-{ TARGET_NR_get_thread_area, "get_thread_area" , NULL, NULL, NULL },
+{ TARGET_NR_get_thread_area, "get_thread_area", "%s(%p)", NULL, NULL },
 #endif
 #ifdef TARGET_NR_gettid
 { TARGET_NR_gettid, "gettid" , NULL, NULL, NULL },
@@ -1234,7 +1234,7 @@ 
 { TARGET_NR_setsockopt, "setsockopt" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_set_thread_area
-{ TARGET_NR_set_thread_area, "set_thread_area" , NULL, NULL, NULL },
+{ TARGET_NR_set_thread_area, "set_thread_area", "%s(%p)", NULL, NULL },
 #endif
 #ifdef TARGET_NR_set_tid_address
 { TARGET_NR_set_tid_address, "set_tid_address" , NULL, NULL, NULL },