linux-user/main.c: Always set QEMU_LD_PREFIX when interp_prefix is changed
PATCH 1/1 linux-user/main.c: Always set QEMU_LD_PREFIX when interp_prefix is changed
From: Chen Gang <[email protected]>
If qemu sets interp_prfix via command line '-L' instead of environments variable QEMU_LD_PREFIX, it will cause syscall execve() failed. Because the 2nd qemu has no command line '-L'.
So qemu need always set QEMU_LD_PREFIX when interp_prefix is changed.
--- linux-user/main.c | 4 ++++ 1 file changed, 4 insertions(+)
linux-user/main.c +4 -0
@@ -3539,7 +3539,11 @@ static void handle_arg_stack_size(const char *arg)static void handle_arg_ld_prefix (const char *arg) { +char *buf =g_strdup_printf ("QEMU_LD_PREFIX=%s" , arg); + interp_prefix =strdup (arg); + (void )envlist_setenv (envlist, buf); +g_free (buf); }static void handle_arg_pagesize (const char *arg)
Signature · 1 line
1.9.1
Quoted 6 lines · On 2015年09月10日 13:43, [email protected] wrote:
From: Chen Gang <[email protected]>
If qemu sets
interp_prfixvia command line '-L' instead of environments variableQEMU_LD_PREFIX, it will cause syscallexecve()failed. Because the 2nd qemu has no command line '-L'.
Oh, sorry for typo, "the 2nd" -> "the second".
Quoted 3 lines
So qemu need always set
QEMU_LD_PREFIXwheninterp_prefixis changed.Signed-off-by Chen Gang <[email protected]>
Thanks.
Signature · 3 lines
Chen Gang Open, share, and attitude like air, water, and life which God blessed
A message that is not in the archive (sent off-list or not yet received): [email protected]
Oh, this issue may be for all command lines (e.g. -d option), I guess, we need process them all in main() when process command line options.
----------------------------------------
Quoted 26 lines
Subject: Re: [PATCH]
linux-user/main.c: Always setQEMU_LD_PREFIXwheninterp_prefixis changed
To: [email protected]
CC: [email protected]; [email protected]; [email protected]
From: [email protected]
Date: Thu, 10 Sep 2015 13:49:18 +0800Quoted 6 lines · On 2015年09月10日 13:43, [email protected] wrote:
From: Chen Gang <[email protected]>
If qemu sets
interp_prfixvia command line '-L' instead of environments variableQEMU_LD_PREFIX, it will cause syscallexecve()failed. Because the 2nd qemu has no command line '-L'.Oh, sorry for typo, "the 2nd" -> "the second".
Quoted 3 lines
So qemu need always set
QEMU_LD_PREFIXwheninterp_prefixis changed.Signed-off-by Chen Gang <[email protected]>Thanks.
--
Chen GangOpen, share, and attitude like air, water, and life which God blessed
Quoted 7 lines · On 10 September 2015 at 06:43, <[email protected]> wrote:
From: Chen Gang <[email protected]>
If qemu sets
interp_prfixvia command line '-L' instead of environments variableQEMU_LD_PREFIX, it will cause syscallexecve()failed. Because the 2nd qemu has no command line '-L'.So qemu need always set
QEMU_LD_PREFIXwheninterp_prefixis changed.
I think this is user error. If you want exec to work automatically onto a second QEMU then you need to set up binfmt misc with a wrapper and probably the environment variables. I don't think we need to turn all our command line switches into environment variables: they're not supposed to be somehow magically inherited by child QEMU processes.
thanks
-- PMM
From: [email protected]
Quoted 9 lines
Date: Thu, 10 Sep 2015 10:02:27 +0100
Quoted 6 lines · On 10 September 2015 at 06:43, <[email protected]> wrote:
From: Chen Gang <[email protected]>
If qemu sets
interp_prfixvia command line '-L' instead of environments variableQEMU_LD_PREFIX, it will cause syscallexecve()failed. Because the 2nd qemu has no command line '-L'.
Quoted 9 lines
Quoted 1 line
So qemu need always set
QEMU_LD_PREFIXwheninterp_prefixis changed.I think this is user error. If you want exec to work automatically onto a second QEMU then you need to set up binfmt misc with a wrapper and probably the environment variables. I don't think we need to turn all our command line switches into environment variables: they're not supposed to be somehow magically inherited by child QEMU processes.
For me, when users type a command line under Linux shell, they always assume all related executions will know about their commands, they need not set the environments again (at least, in one process, they assume so).
execve() will not change the pid, so the users will 'feel': they are using only one process.
I guess all 'users' will support me (this patch will let them a little easier). ;-)
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
Quoted 20 lines · Chen Gang
From: [email protected]
Quoted 9 lines
Date: Thu, 10 Sep 2015 10:02:27 +0100
Quoted 6 lines · On 10 September 2015 at 06:43, <[email protected]> wrote:
From: Chen Gang <[email protected]>
If qemu sets
interp_prfixvia command line '-L' instead of environments variableQEMU_LD_PREFIX, it will cause syscallexecve()failed. Because the 2nd qemu has no command line '-L'.Quoted 9 lines
Quoted 1 line
So qemu need always set
QEMU_LD_PREFIXwheninterp_prefixis changed.I think this is user error. If you want exec to work automatically onto a second QEMU then you need to set up binfmt misc with a wrapper and probably the environment variables. I don't think we need to turn all our command line switches into environment variables: they're not supposed to be somehow magically inherited by child QEMU processes.
Quoted 6 lines
For me, when users type a command line under Linux shell, they always assume all related executions will know about their commands, they need not set the environments again (at least, in one process, they assume so).
execve()will not change the pid, so the users will 'feel': they are using only one process.
But execve won't do the right thing if it's another target binary, unless you've set up binfmt_misc. And if you're setting up binfmt_misc then (a) you should just do it right and (b) you wouldn't have been directly running QEMU with command line arguments in the first place.
I really don't think we need to change anything here.
thanks
-- PMM
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Chen Gang
For me, when users type a command line under Linux shell, they always assume all related executions will know about their commands, they need not set the environments again (at least, in one process, they assume so).
Quoted 9 lines
Quoted 2 lines
execve()will not change the pid, so the users will 'feel': they are using only one process.But execve won't do the right thing if it's another target binary, unless you've set up
binfmt_misc. And if you're setting upbinfmt_miscthen (a) you should just do it right and (b) you wouldn't have been directly running QEMU with command line arguments in the first place.
Yes, we have to use binfmt_misc to let execve() run correctly. After let execve() run correctly, I am analyzing another issue when let qemu run wine (it is a pending issue, I guess, it is related with mmu).
At present, I often change the input parameters (e.g. -strace, -d ...), if we let a qemu process itself always know about its input parameters, it will be really useful.
For qemu, I still feel that we need notice about the mismatch between env variables and input parameters.
- If we are sure the input parameters are only for one normal process, we need not care about the mismatch between env variables and input parameters (I guess, most of programs need not care about it).
- But if we have to process the un-normal process (e.g. our qemu), we have to notice about the mismatch between evn variables and input parameters. Or command line users may meet various strange things.
- Since we provide the command line options, we have to always let them be correct within one normal or un-normal process.
Thanks
Signature · 3 lines
Chen Gang (陈刚) Open, share, and attitude like air, water, and life which God blessed
Quoted 7 lines · Chen Gang
Yes, we have to use
binfmt_miscto letexecve()run correctly. After letexecve()run correctly, I am analyzing another issue when let qemu run wine (it is a pending issue, I guess, it is related with mmu).At present, I often change the input parameters (e.g. -strace, -d ...), if we let a qemu process itself always know about its input parameters, it will be really useful.
If you want settings to apply to all child qemu processes, use the environment variables... that is one of the things they are for.
Quoted 7 lines
For qemu, I still feel that we need notice about the mismatch between env variables and input parameters.
- If we are sure the input parameters are only for one normal process, we need not care about the mismatch between env variables and input parameters (I guess, most of programs need not care about it).
Quoted 6 lines
- But if we have to process the un-normal process (e.g. our qemu), we have to notice about the mismatch between evn variables and input parameters. Or command line users may meet various strange things.
- Since we provide the command line options, we have to always let them be correct within one normal or un-normal process.
I think it would be unexpected behaviour for command line arguments provided to one QEMU program to affect the execution of a different QEMU process.
thanks
-- PMM
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Chen Gang
Yes, we have to use
binfmt_miscto letexecve()run correctly. After letexecve()run correctly, I am analyzing another issue when let qemu run wine (it is a pending issue, I guess, it is related with mmu).
Quoted 7 lines
Quoted 3 lines
At present, I often change the input parameters (e.g. -strace, -d ...), if we let a qemu process itself always know about its input parameters, it will be really useful.
If you want settings to apply to all child qemu processes, use the environment variables... that is one of the things they are for.
Yes it will be work well. :-)
Quoted 11 lines
Quoted 11 lines
For qemu, I still feel that we need notice about the mismatch between env variables and input parameters.
- If we are sure the input parameters are only for one normal process, we need not care about the mismatch between env variables and input parameters (I guess, most of programs need not care about it).
- But if we have to process the un-normal process (e.g. our qemu), we have to notice about the mismatch between evn variables and input parameters. Or command line users may meet various strange things.
Quoted 7 lines
Quoted 2 lines
- Since we provide the command line options, we have to always let them be correct within one normal or un-normal process.
I think it would be unexpected behaviour for command line arguments provided to one QEMU program to affect the execution of a different QEMU process.
For me, I guess, it should be still OK:
- For execve(), the input parameters should always have effect with ( since we treate it as one un-normal process).
- For other QEMU cases (really different QEMU child processes).
If they have their own command line options, the will override the env variables which may be set by original command line parameters.
If they have no their own command line options, they need inherit the parent QEMU process's command line options (e.g. -strace, -d ...).
Thanks.
Signature · 3 lines
Chen Gang (陈刚) Open, share, and attitude like air, water, and life which God blessed