diff mbox

[v2,3/4] linux-user: pass elf interpreter prefix in execve

Message ID 1465932382-28645-4-git-send-email-joel.holdsworth@vcatechnology.com
State New
Headers show

Commit Message

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

Comments

Laurent Vivier June 15, 2016, 8:06 p.m. UTC | #1
More details: why do we need this?

Add your Signed-off-by.

Le 14/06/2016 à 21:26, Joel Holdsworth a écrit :
> ---
>  linux-user/syscall.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 440986e..1513f0f 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6667,7 +6667,7 @@ static abi_long qemu_execve(char *filename, char *argv[],
>      char *i_arg = NULL, *i_name = NULL;
>      char **qemu_argp, **argp;
>      int i, j;
> -    size_t qemu_argc = 3, argc, host_envc, envpc;
> +    size_t qemu_argc = 5, argc, host_envc, envpc;
>      int fd, ret;
>      char *cp;
>      size_t def_envc = 0, undef_envc = 0;
> @@ -6782,6 +6782,8 @@ static abi_long qemu_execve(char *filename, char *argv[],
>  
>      /* set up the qemu arguments */
>      *argp++ = strdup(qemu_execve_path);
> +    *argp++ = strdup("-L");
> +    *argp++ = strdup(path("/"));

why "/"?

You should propagate the one from the parent (if != NULL).

>  
>      /* add arguments for the enironment variables */
>      for (i = 0; i < def_envc; i++) {
> 

Laurent
Joel Holdsworth June 20, 2016, 7:57 p.m. UTC | #2
On 15/06/16 21:06, Laurent Vivier wrote:
> More details: why do we need this?
>
> Add your Signed-off-by.
>
> Le 14/06/2016 à 21:26, Joel Holdsworth a écrit :
>> ---
>>   linux-user/syscall.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>> index 440986e..1513f0f 100644
>> --- a/linux-user/syscall.c
>> +++ b/linux-user/syscall.c
>> @@ -6667,7 +6667,7 @@ static abi_long qemu_execve(char *filename, char *argv[],
>>       char *i_arg = NULL, *i_name = NULL;
>>       char **qemu_argp, **argp;
>>       int i, j;
>> -    size_t qemu_argc = 3, argc, host_envc, envpc;
>> +    size_t qemu_argc = 5, argc, host_envc, envpc;
>>       int fd, ret;
>>       char *cp;
>>       size_t def_envc = 0, undef_envc = 0;
>> @@ -6782,6 +6782,8 @@ static abi_long qemu_execve(char *filename, char *argv[],
>>   
>>       /* set up the qemu arguments */
>>       *argp++ = strdup(qemu_execve_path);
>> +    *argp++ = strdup("-L");
>> +    *argp++ = strdup(path("/"));
> why "/"?
>
> You should propagate the one from the parent (if != NULL).

path("/") seems to be the easiest way to get access to 'static struct 
pathelem *base' in util/path.c, which is set from the parent's -L<path> 
in init_paths.
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 440986e..1513f0f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6667,7 +6667,7 @@  static abi_long qemu_execve(char *filename, char *argv[],
     char *i_arg = NULL, *i_name = NULL;
     char **qemu_argp, **argp;
     int i, j;
-    size_t qemu_argc = 3, argc, host_envc, envpc;
+    size_t qemu_argc = 5, argc, host_envc, envpc;
     int fd, ret;
     char *cp;
     size_t def_envc = 0, undef_envc = 0;
@@ -6782,6 +6782,8 @@  static abi_long qemu_execve(char *filename, char *argv[],
 
     /* set up the qemu arguments */
     *argp++ = strdup(qemu_execve_path);
+    *argp++ = strdup("-L");
+    *argp++ = strdup(path("/"));
 
     /* add arguments for the enironment variables */
     for (i = 0; i < def_envc; i++) {