qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
@ 2016-12-14 13:35 Vlad Lungu
  2016-12-14 14:38 ` Eduardo Habkost
  0 siblings, 1 reply; 11+ messages in thread
From: Vlad Lungu @ 2016-12-14 13:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, ehabkost, rth


get_opt_value() truncates the value at the first comma
Use memcpy() instead

Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
---
  hw/i386/multiboot.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 387caa6..b4495ad 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -109,7 +109,7 @@ static uint32_t mb_add_cmdline(MultibootState *s, 
const char *cmdline)
      hwaddr p = s->offset_cmdlines;
      char *b = (char *)s->mb_buf + p;

-    get_opt_value(b, strlen(cmdline) + 1, cmdline);
+    memcpy(b, cmdline, strlen(cmdline) + 1);
      s->offset_cmdlines += strlen(b) + 1;
      return s->mb_buf_phys + p;
  }
-- 
1.9.1

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 13:35 Vlad Lungu
@ 2016-12-14 14:38 ` Eduardo Habkost
  0 siblings, 0 replies; 11+ messages in thread
From: Eduardo Habkost @ 2016-12-14 14:38 UTC (permalink / raw)
  To: Vlad Lungu; +Cc: qemu-devel, pbonzini, rth

On Wed, Dec 14, 2016 at 03:35:29PM +0200, Vlad Lungu wrote:
> 
> get_opt_value() truncates the value at the first comma
> Use memcpy() instead
> 
> Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>

Your patch is corrupted. I suggest using git-send-email instead
of Thunderbird, but you might want to take a look at:
http://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email

> ---
>  hw/i386/multiboot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
> index 387caa6..b4495ad 100644
> --- a/hw/i386/multiboot.c
> +++ b/hw/i386/multiboot.c
> @@ -109,7 +109,7 @@ static uint32_t mb_add_cmdline(MultibootState *s, const
> char *cmdline)
>      hwaddr p = s->offset_cmdlines;
>      char *b = (char *)s->mb_buf + p;
> 
> -    get_opt_value(b, strlen(cmdline) + 1, cmdline);

One caller of mb_add_cmdline() relies on get_opt_value() to allow
multiple initrd modules to be specified on the command-line. But:
* The caller already splits the string manually by adding a null
  terminator;
* The caller is already broken if filenames contain "," (because
  it doesn't handle ",," escaping)
so it won't be affected by the change, and it would need to
handle escaping before calling mb_add_cmdline() anyway.

The other caller of mb_add_cmdline() (kcmdline) doesn't need
option splitting/parsing.

So, not using get_opt_value() here makes sense.

But:

> +    memcpy(b, cmdline, strlen(cmdline) + 1);

This is equivalent to strcpy(), and it is ignoring the size of
mb_buf.

The existing code looks very dangerous: the size of mb_buf is
calculated based on the image contents, and then it doesn't check
the buffer size before writing to it.

>      s->offset_cmdlines += strlen(b) + 1;
>      return s->mb_buf_phys + p;
>  }
> -- 
> 1.9.1
> 
> 

-- 
Eduardo

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

* [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
@ 2016-12-14 16:19 Vlad Lungu
  2016-12-14 16:55 ` Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Vlad Lungu @ 2016-12-14 16:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, ehabkost, rth, Vlad Lungu

get_opt_value() truncates the value at the first comma.
Use memcpy() instead.

Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
---
 hw/i386/multiboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 387caa6..b4495ad 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -109,7 +109,7 @@ static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
     hwaddr p = s->offset_cmdlines;
     char *b = (char *)s->mb_buf + p;
 
-    get_opt_value(b, strlen(cmdline) + 1, cmdline);
+    memcpy(b, cmdline, strlen(cmdline) + 1);
     s->offset_cmdlines += strlen(b) + 1;
     return s->mb_buf_phys + p;
 }
-- 
1.9.1

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 16:19 [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim Vlad Lungu
@ 2016-12-14 16:55 ` Paolo Bonzini
  2016-12-14 17:00   ` Eduardo Habkost
  0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2016-12-14 16:55 UTC (permalink / raw)
  To: Vlad Lungu, qemu-devel; +Cc: ehabkost, rth



On 14/12/2016 17:19, Vlad Lungu wrote:
> get_opt_value() truncates the value at the first comma.
> Use memcpy() instead.

Looks good since get_opt_value is already used by the caller.  Have you
tested this with multiple initrd modules too?

Paolo

> Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
> ---
>  hw/i386/multiboot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
> index 387caa6..b4495ad 100644
> --- a/hw/i386/multiboot.c
> +++ b/hw/i386/multiboot.c
> @@ -109,7 +109,7 @@ static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
>      hwaddr p = s->offset_cmdlines;
>      char *b = (char *)s->mb_buf + p;
>  
> -    get_opt_value(b, strlen(cmdline) + 1, cmdline);
> +    memcpy(b, cmdline, strlen(cmdline) + 1);
>      s->offset_cmdlines += strlen(b) + 1;
>      return s->mb_buf_phys + p;
>  }
> 

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 16:55 ` Paolo Bonzini
@ 2016-12-14 17:00   ` Eduardo Habkost
  2016-12-14 17:20     ` Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Eduardo Habkost @ 2016-12-14 17:00 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Vlad Lungu, qemu-devel, rth

On Wed, Dec 14, 2016 at 05:55:07PM +0100, Paolo Bonzini wrote:
> 
> 
> On 14/12/2016 17:19, Vlad Lungu wrote:
> > get_opt_value() truncates the value at the first comma.
> > Use memcpy() instead.
> 
> Looks good since get_opt_value is already used by the caller.  Have you
> tested this with multiple initrd modules too?

get_opt_value() is used by the caller, but with NULL buf
argument. This means the caller doesn't handle ",," escaping.
(See my reply to the previous submission of this patch)

However this only means the caller is buggy, not
mb_add_cmdline(). So the change still looks good to me.

> 
> Paolo
> 
> > Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
> > ---
> >  hw/i386/multiboot.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
> > index 387caa6..b4495ad 100644
> > --- a/hw/i386/multiboot.c
> > +++ b/hw/i386/multiboot.c
> > @@ -109,7 +109,7 @@ static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
> >      hwaddr p = s->offset_cmdlines;
> >      char *b = (char *)s->mb_buf + p;
> >  
> > -    get_opt_value(b, strlen(cmdline) + 1, cmdline);
> > +    memcpy(b, cmdline, strlen(cmdline) + 1);
> >      s->offset_cmdlines += strlen(b) + 1;
> >      return s->mb_buf_phys + p;
> >  }
> > 

-- 
Eduardo

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 17:00   ` Eduardo Habkost
@ 2016-12-14 17:20     ` Paolo Bonzini
  2016-12-14 17:51       ` Eduardo Habkost
  0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2016-12-14 17:20 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Vlad Lungu, qemu-devel, rth



On 14/12/2016 18:00, Eduardo Habkost wrote:
> On Wed, Dec 14, 2016 at 05:55:07PM +0100, Paolo Bonzini wrote:
>>
>>
>> On 14/12/2016 17:19, Vlad Lungu wrote:
>>> get_opt_value() truncates the value at the first comma.
>>> Use memcpy() instead.
>>
>> Looks good since get_opt_value is already used by the caller.  Have you
>> tested this with multiple initrd modules too?
> 
> get_opt_value() is used by the caller, but with NULL buf
> argument. This means the caller doesn't handle ",," escaping.
> (See my reply to the previous submission of this patch)

Hmm, wait.  When NULL is passed, ",," escaping is handled correctly in
that next_initrd points to the next lone comma.  The lone comma is
replaced with a '\0' by the caller.

So you need to use get_opt_value again in mb_add_cmdline to do the
unescaping, because mb_add_cmdline only receives double commas.

This was actually my first reaction to the patch, and it was correct.
Then I overthought it. :)

So the patch is wrong.

Paolo

> However this only means the caller is buggy, not
> mb_add_cmdline(). So the change still looks good to me.
> 
>>
>> Paolo
>>
>>> Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
>>> ---
>>>  hw/i386/multiboot.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
>>> index 387caa6..b4495ad 100644
>>> --- a/hw/i386/multiboot.c
>>> +++ b/hw/i386/multiboot.c
>>> @@ -109,7 +109,7 @@ static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
>>>      hwaddr p = s->offset_cmdlines;
>>>      char *b = (char *)s->mb_buf + p;
>>>  
>>> -    get_opt_value(b, strlen(cmdline) + 1, cmdline);
>>> +    memcpy(b, cmdline, strlen(cmdline) + 1);
>>>      s->offset_cmdlines += strlen(b) + 1;
>>>      return s->mb_buf_phys + p;
>>>  }
>>>
> 

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 17:20     ` Paolo Bonzini
@ 2016-12-14 17:51       ` Eduardo Habkost
  2016-12-14 21:38         ` Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Eduardo Habkost @ 2016-12-14 17:51 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Vlad Lungu, qemu-devel, rth

On Wed, Dec 14, 2016 at 06:20:46PM +0100, Paolo Bonzini wrote:
> On 14/12/2016 18:00, Eduardo Habkost wrote:
> > On Wed, Dec 14, 2016 at 05:55:07PM +0100, Paolo Bonzini wrote:
> >>
> >>
> >> On 14/12/2016 17:19, Vlad Lungu wrote:
> >>> get_opt_value() truncates the value at the first comma.
> >>> Use memcpy() instead.
> >>
> >> Looks good since get_opt_value is already used by the caller.  Have you
> >> tested this with multiple initrd modules too?
> > 
> > get_opt_value() is used by the caller, but with NULL buf
> > argument. This means the caller doesn't handle ",," escaping.
> > (See my reply to the previous submission of this patch)
> 
> Hmm, wait.  When NULL is passed, ",," escaping is handled correctly in
> that next_initrd points to the next lone comma.  The lone comma is
> replaced with a '\0' by the caller.

It is handled correctly when splitting the string, but not when opening the
file.

> 
> So you need to use get_opt_value again in mb_add_cmdline to do the
> unescaping, because mb_add_cmdline only receives double commas.
> 
> This was actually my first reaction to the patch, and it was correct.
> Then I overthought it. :)
> 
> So the patch is wrong.

Except that the caller is already broken when using ",," for a
different reason: it calls get_image_size(initrd_filename) and
load_image(initrd_filename, ...) directly. So comma-escaping
never worked anyway:

  $ qemu-system-x86_64 -kernel ~/Downloads/gnumach -initrd /tmp/one,,file,/tmp/another,,file
  Failed to open file '/tmp/one,,file'

The right fix for comma-escaping would require calling
get_opt_value() with non-NULL buf outside mb_add_cmdline(),
because the mb_add_cmdline(&mbs, kcmdline) call do NOT need
get_opt_value() to be called.

In other words: this fixes the mb_add_cmdline(kcmdline) case, and
doesn't break comma escaping on the initrd case (because it was
already broken). I don't see a problem with this patch.

> 
> Paolo
> 
> > However this only means the caller is buggy, not
> > mb_add_cmdline(). So the change still looks good to me.
> > 
> >>
> >> Paolo
> >>
> >>> Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
> >>> ---
> >>>  hw/i386/multiboot.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
> >>> index 387caa6..b4495ad 100644
> >>> --- a/hw/i386/multiboot.c
> >>> +++ b/hw/i386/multiboot.c
> >>> @@ -109,7 +109,7 @@ static uint32_t mb_add_cmdline(MultibootState *s, const char *cmdline)
> >>>      hwaddr p = s->offset_cmdlines;
> >>>      char *b = (char *)s->mb_buf + p;
> >>>  
> >>> -    get_opt_value(b, strlen(cmdline) + 1, cmdline);
> >>> +    memcpy(b, cmdline, strlen(cmdline) + 1);
> >>>      s->offset_cmdlines += strlen(b) + 1;
> >>>      return s->mb_buf_phys + p;
> >>>  }
> >>>
> > 

-- 
Eduardo

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 17:51       ` Eduardo Habkost
@ 2016-12-14 21:38         ` Paolo Bonzini
  2016-12-14 22:26           ` Eduardo Habkost
  0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2016-12-14 21:38 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Vlad Lungu, qemu-devel, rth



----- Original Message -----
> From: "Eduardo Habkost" <ehabkost@redhat.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>
> Cc: "Vlad Lungu" <vlad.lungu@windriver.com>, qemu-devel@nongnu.org, rth@twiddle.net
> Sent: Wednesday, December 14, 2016 6:51:44 PM
> Subject: Re: [PATCH] multiboot: copy the cmdline verbatim
> 
> On Wed, Dec 14, 2016 at 06:20:46PM +0100, Paolo Bonzini wrote:
> > On 14/12/2016 18:00, Eduardo Habkost wrote:
> > > On Wed, Dec 14, 2016 at 05:55:07PM +0100, Paolo Bonzini wrote:
> > >>
> > >>
> > >> On 14/12/2016 17:19, Vlad Lungu wrote:
> > >>> get_opt_value() truncates the value at the first comma.
> > >>> Use memcpy() instead.
> > >>
> > >> Looks good since get_opt_value is already used by the caller.  Have you
> > >> tested this with multiple initrd modules too?
> > > 
> > > get_opt_value() is used by the caller, but with NULL buf
> > > argument. This means the caller doesn't handle ",," escaping.
> > > (See my reply to the previous submission of this patch)
> > 
> > Hmm, wait.  When NULL is passed, ",," escaping is handled correctly in
> > that next_initrd points to the next lone comma.  The lone comma is
> > replaced with a '\0' by the caller.
> 
> It is handled correctly when splitting the string, but not when opening the
> file.
> 
> > 
> > So you need to use get_opt_value again in mb_add_cmdline to do the
> > unescaping, because mb_add_cmdline only receives double commas.
> > 
> > This was actually my first reaction to the patch, and it was correct.
> > Then I overthought it. :)
> > 
> > So the patch is wrong.
> 
> Except that the caller is already broken when using ",," for a
> different reason: it calls get_image_size(initrd_filename) and
> load_image(initrd_filename, ...) directly. So comma-escaping
> never worked anyway:
> 
>   $ qemu-system-x86_64 -kernel ~/Downloads/gnumach -initrd
>   /tmp/one,,file,/tmp/another,,file
>   Failed to open file '/tmp/one,,file'
> 
> The right fix for comma-escaping would require calling
> get_opt_value() with non-NULL buf outside mb_add_cmdline(),
> because the mb_add_cmdline(&mbs, kcmdline) call do NOT need
> get_opt_value() to be called.

For filenames containing commas you're right, but...

> In other words: this fixes the mb_add_cmdline(kcmdline) case, and
> doesn't break comma escaping on the initrd case (because it was
> already broken). I don't see a problem with this patch.

... there is one case of comma escaping that wasn't broken:

    $ qemu-system-x86_64 -kernel foo -initrd '/tmp/one arg,,with,,commas,/tmp/another arg,,with,,commas'

And presumably this is what Vlad was trying to do.

Paolo

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 21:38         ` Paolo Bonzini
@ 2016-12-14 22:26           ` Eduardo Habkost
  2016-12-14 22:32             ` Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Eduardo Habkost @ 2016-12-14 22:26 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Vlad Lungu, qemu-devel, rth

On Wed, Dec 14, 2016 at 04:38:07PM -0500, Paolo Bonzini wrote:
> 
> 
> ----- Original Message -----
> > From: "Eduardo Habkost" <ehabkost@redhat.com>
> > To: "Paolo Bonzini" <pbonzini@redhat.com>
> > Cc: "Vlad Lungu" <vlad.lungu@windriver.com>, qemu-devel@nongnu.org, rth@twiddle.net
> > Sent: Wednesday, December 14, 2016 6:51:44 PM
> > Subject: Re: [PATCH] multiboot: copy the cmdline verbatim
> > 
> > On Wed, Dec 14, 2016 at 06:20:46PM +0100, Paolo Bonzini wrote:
> > > On 14/12/2016 18:00, Eduardo Habkost wrote:
> > > > On Wed, Dec 14, 2016 at 05:55:07PM +0100, Paolo Bonzini wrote:
> > > >>
> > > >>
> > > >> On 14/12/2016 17:19, Vlad Lungu wrote:
> > > >>> get_opt_value() truncates the value at the first comma.
> > > >>> Use memcpy() instead.
> > > >>
> > > >> Looks good since get_opt_value is already used by the caller.  Have you
> > > >> tested this with multiple initrd modules too?
> > > > 
> > > > get_opt_value() is used by the caller, but with NULL buf
> > > > argument. This means the caller doesn't handle ",," escaping.
> > > > (See my reply to the previous submission of this patch)
> > > 
> > > Hmm, wait.  When NULL is passed, ",," escaping is handled correctly in
> > > that next_initrd points to the next lone comma.  The lone comma is
> > > replaced with a '\0' by the caller.
> > 
> > It is handled correctly when splitting the string, but not when opening the
> > file.
> > 
> > > 
> > > So you need to use get_opt_value again in mb_add_cmdline to do the
> > > unescaping, because mb_add_cmdline only receives double commas.
> > > 
> > > This was actually my first reaction to the patch, and it was correct.
> > > Then I overthought it. :)
> > > 
> > > So the patch is wrong.
> > 
> > Except that the caller is already broken when using ",," for a
> > different reason: it calls get_image_size(initrd_filename) and
> > load_image(initrd_filename, ...) directly. So comma-escaping
> > never worked anyway:
> > 
> >   $ qemu-system-x86_64 -kernel ~/Downloads/gnumach -initrd
> >   /tmp/one,,file,/tmp/another,,file
> >   Failed to open file '/tmp/one,,file'
> > 
> > The right fix for comma-escaping would require calling
> > get_opt_value() with non-NULL buf outside mb_add_cmdline(),
> > because the mb_add_cmdline(&mbs, kcmdline) call do NOT need
> > get_opt_value() to be called.
> 
> For filenames containing commas you're right, but...
> 
> > In other words: this fixes the mb_add_cmdline(kcmdline) case, and
> > doesn't break comma escaping on the initrd case (because it was
> > already broken). I don't see a problem with this patch.
> 
> ... there is one case of comma escaping that wasn't broken:
> 
>     $ qemu-system-x86_64 -kernel foo -initrd '/tmp/one arg,,with,,commas,/tmp/another arg,,with,,commas'
> 

Oh, I didn't notice the whitespace-based split for initrd
arguments.

This is messier than I thought. Maybe the simplest solution is to
inline mb_add_cmdline() at both callers, and change the kcmdline
one to use memcpy().

> And presumably this is what Vlad was trying to do.

I believe he was trying to fix -append, not -initrd. The patch
fixes -append, but breaks comma-escaping on -initrd.

-- 
Eduardo

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 22:26           ` Eduardo Habkost
@ 2016-12-14 22:32             ` Paolo Bonzini
  2016-12-15  9:44               ` Vlad Lungu
  0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2016-12-14 22:32 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Vlad Lungu, qemu-devel, rth

> > > In other words: this fixes the mb_add_cmdline(kcmdline) case, and
> > > doesn't break comma escaping on the initrd case (because it was
> > > already broken). I don't see a problem with this patch.
> > 
> > ... there is one case of comma escaping that wasn't broken:
> > 
> >     $ qemu-system-x86_64 -kernel foo -initrd '/tmp/one
> >     arg,,with,,commas,/tmp/another arg,,with,,commas'
> > 
> 
> Oh, I didn't notice the whitespace-based split for initrd
> arguments.
> 
> This is messier than I thought. Maybe the simplest solution is to
> inline mb_add_cmdline() at both callers, and change the kcmdline
> one to use memcpy().

Yes, I agree.

Paolo

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

* Re: [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim
  2016-12-14 22:32             ` Paolo Bonzini
@ 2016-12-15  9:44               ` Vlad Lungu
  0 siblings, 0 replies; 11+ messages in thread
From: Vlad Lungu @ 2016-12-15  9:44 UTC (permalink / raw)
  To: Paolo Bonzini, Eduardo Habkost; +Cc: qemu-devel, rth



On 12/15/2016 12:32 AM, Paolo Bonzini wrote:
>>>> In other words: this fixes the mb_add_cmdline(kcmdline) case, and
>>>> doesn't break comma escaping on the initrd case (because it was
>>>> already broken). I don't see a problem with this patch.
>>> ... there is one case of comma escaping that wasn't broken:
>>>
>>>     $ qemu-system-x86_64 -kernel foo -initrd '/tmp/one
>>>     arg,,with,,commas,/tmp/another arg,,with,,commas'
>>>
>> Oh, I didn't notice the whitespace-based split for initrd
>> arguments.
So that's how it works :-)
>> This is messier than I thought. Maybe the simplest solution is to
>> inline mb_add_cmdline() at both callers, and change the kcmdline
>> one to use memcpy().
>

OK, I have a new version that does with memcpy for the cmdline, with
get_opt_value() for the modules and also unescapes the filename for
get_image_size()/load_image() . You still can't have spaces in filenames,
so maybe a new scheme should be devised for this.

Regards,
Vlad

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

end of thread, other threads:[~2016-12-15  9:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-14 16:19 [Qemu-devel] [PATCH] multiboot: copy the cmdline verbatim Vlad Lungu
2016-12-14 16:55 ` Paolo Bonzini
2016-12-14 17:00   ` Eduardo Habkost
2016-12-14 17:20     ` Paolo Bonzini
2016-12-14 17:51       ` Eduardo Habkost
2016-12-14 21:38         ` Paolo Bonzini
2016-12-14 22:26           ` Eduardo Habkost
2016-12-14 22:32             ` Paolo Bonzini
2016-12-15  9:44               ` Vlad Lungu
  -- strict thread matches above, loose matches on Subject: below --
2016-12-14 13:35 Vlad Lungu
2016-12-14 14:38 ` Eduardo Habkost

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).