qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user: strace now handles unshare syscall args correctly
@ 2021-04-06 14:11 Matus Kysel
  2021-04-06 14:23 ` Laurent Vivier
  0 siblings, 1 reply; 2+ messages in thread
From: Matus Kysel @ 2021-04-06 14:11 UTC (permalink / raw)
  Cc: open list:All patches CC here, Laurent Vivier, Matus Kysel

Syscall unshare did not have custom print function for strace, but it's argument is same as flags in clone syscall, so it can be easily implemented.

Signed-off-by: Matus Kysel <mkysel@tachyum.com>
---
 linux-user/strace.c    | 12 ++++++++++++
 linux-user/strace.list |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index e969121b6c..d48df8c1a9 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -3467,6 +3467,18 @@ print_unlinkat(void *cpu_env, const struct syscallname *name,
 }
 #endif

+#ifdef TARGET_NR_unshare
+static void
+print_unshare(void *cpu_env, const struct syscallname *name,
+              abi_long arg0, abi_long arg1, abi_long arg2,
+              abi_long arg3, abi_long arg4, abi_long arg5)
+{
+    print_syscall_prologue(name);
+    print_flags(clone_flags, arg0, 1);
+    print_syscall_epilogue(name);
+}
+#endif
+
 #ifdef TARGET_NR_utime
 static void
 print_utime(void *cpu_env, const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 084048ab96..3b7c15578c 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1573,7 +1573,7 @@
 { TARGET_NR_unlinkat, "unlinkat" , NULL, print_unlinkat, NULL },
 #endif
 #ifdef TARGET_NR_unshare
-{ TARGET_NR_unshare, "unshare" , NULL, NULL, NULL },
+{ TARGET_NR_unshare, "unshare" , NULL, print_unshare, NULL },
 #endif
 #ifdef TARGET_NR_userfaultfd
 { TARGET_NR_userfaultfd, "userfaultfd" , NULL, NULL, NULL },
--
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] linux-user: strace now handles unshare syscall args correctly
  2021-04-06 14:11 [PATCH] linux-user: strace now handles unshare syscall args correctly Matus Kysel
@ 2021-04-06 14:23 ` Laurent Vivier
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Vivier @ 2021-04-06 14:23 UTC (permalink / raw)
  To: Matus Kysel; +Cc: open list:All patches CC here

Le 06/04/2021 à 16:11, Matus Kysel a écrit :
> Syscall unshare did not have custom print function for strace, but it's argument is same as flags in clone syscall, so it can be easily implemented.
> 
> Signed-off-by: Matus Kysel <mkysel@tachyum.com>
> ---
>  linux-user/strace.c    | 12 ++++++++++++
>  linux-user/strace.list |  2 +-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index e969121b6c..d48df8c1a9 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -3467,6 +3467,18 @@ print_unlinkat(void *cpu_env, const struct syscallname *name,
>  }
>  #endif
> 
> +#ifdef TARGET_NR_unshare
> +static void
> +print_unshare(void *cpu_env, const struct syscallname *name,
> +              abi_long arg0, abi_long arg1, abi_long arg2,
> +              abi_long arg3, abi_long arg4, abi_long arg5)
> +{
> +    print_syscall_prologue(name);
> +    print_flags(clone_flags, arg0, 1);
> +    print_syscall_epilogue(name);
> +}
> +#endif
> +
>  #ifdef TARGET_NR_utime
>  static void
>  print_utime(void *cpu_env, const struct syscallname *name,
> diff --git a/linux-user/strace.list b/linux-user/strace.list
> index 084048ab96..3b7c15578c 100644
> --- a/linux-user/strace.list
> +++ b/linux-user/strace.list
> @@ -1573,7 +1573,7 @@
>  { TARGET_NR_unlinkat, "unlinkat" , NULL, print_unlinkat, NULL },
>  #endif
>  #ifdef TARGET_NR_unshare
> -{ TARGET_NR_unshare, "unshare" , NULL, NULL, NULL },
> +{ TARGET_NR_unshare, "unshare" , NULL, print_unshare, NULL },
>  #endif
>  #ifdef TARGET_NR_userfaultfd
>  { TARGET_NR_userfaultfd, "userfaultfd" , NULL, NULL, NULL },
> --
> 2.25.1
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

While you are at it, you can also update the clone_flags list
(at least CLONE_NEWTIME and CLONE_NEWCGROUP are missing)

Thansk,
Laurent



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-06 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 14:11 [PATCH] linux-user: strace now handles unshare syscall args correctly Matus Kysel
2021-04-06 14:23 ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).