diff mbox

[v2,4/4] linux-user: pass strace argument in execve

Message ID 1465932382-28645-5-git-send-email-joel.holdsworth@vcatechnology.com (mailing list archive)
State New, archived
Headers show

Commit Message

Joel Holdsworth June 14, 2016, 7:26 p.m. UTC
---
 linux-user/syscall.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Laurent Vivier June 15, 2016, 8:37 p.m. UTC | #1
This is not needed: if you use QEMU_STRACE environment variable, it is
propagated to the child processes (this is also true for "-L" and
QEMU_LD_PREFIX).

In fact, your patch 2 breaks this...

Did you try to use a statically linked qemu?

IMHO, the best way to avoid environment problem is to have a qemu
ignoring it, not modifying it.

Thanks,
Laurent

Le 14/06/2016 à 21:26, Joel Holdsworth a écrit :
> ---
>  linux-user/syscall.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 1513f0f..00ee7a6 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6778,6 +6778,8 @@ static abi_long qemu_execve(char *filename, char *argv[],
>      qemu_argc += undef_envc * 2;
>  
>      /* allocate the argument list */
> +    if (do_strace)
> +        qemu_argc++;
>      argp = qemu_argp = alloca((qemu_argc + 1) * sizeof(void *));
>  
>      /* set up the qemu arguments */
> @@ -6785,6 +6787,9 @@ static abi_long qemu_execve(char *filename, char *argv[],
>      *argp++ = strdup("-L");
>      *argp++ = strdup(path("/"));
>  
> +    if (do_strace)
> +        *argp++ = strdup("-strace");
> +
>      /* add arguments for the enironment variables */
>      for (i = 0; i < def_envc; i++) {
>          *argp++ = strdup("-E");
>
Joel Holdsworth June 20, 2016, 8:02 p.m. UTC | #2
On 15/06/16 21:37, Laurent Vivier wrote:
> This is not needed: if you use QEMU_STRACE environment variable, it is
> propagated to the child processes (this is also true for "-L" and
> QEMU_LD_PREFIX).
I would say that breaks the rule of least surprise for the user. If 
we're going to invoke a child instance of qemu-user, then I think the 
user would expect us to propage the arguments from the parent.

>
> In fact, your patch 2 breaks this...
Ok - my mistake. I will test it.


> Did you try to use a statically linked qemu?
See my comments in patch #2.
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1513f0f..00ee7a6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6778,6 +6778,8 @@  static abi_long qemu_execve(char *filename, char *argv[],
     qemu_argc += undef_envc * 2;
 
     /* allocate the argument list */
+    if (do_strace)
+        qemu_argc++;
     argp = qemu_argp = alloca((qemu_argc + 1) * sizeof(void *));
 
     /* set up the qemu arguments */
@@ -6785,6 +6787,9 @@  static abi_long qemu_execve(char *filename, char *argv[],
     *argp++ = strdup("-L");
     *argp++ = strdup(path("/"));
 
+    if (do_strace)
+        *argp++ = strdup("-strace");
+
     /* add arguments for the enironment variables */
     for (i = 0; i < def_envc; i++) {
         *argp++ = strdup("-E");