All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
@ 2016-03-15 13:55 Michael S. Tsirkin
  2016-03-15 14:14 ` Paolo Bonzini
  0 siblings, 1 reply; 12+ messages in thread
From: Michael S. Tsirkin @ 2016-03-15 13:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Gerd Hoffmann, Corey Minyard

Allowing arbitary file names on command line is setting us up for
failure: future guests will look for a specific QEMU-specified name and
will get confused finding a user file there.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 vl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vl.c b/vl.c
index 7a28982..5654af6 100644
--- a/vl.c
+++ b/vl.c
@@ -2321,6 +2321,7 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
     if (strncmp(name, "opt/", 4) != 0) {
-        error_report("warning: externally provided fw_cfg item names "
-                     "should be prefixed with \"opt/\"");
+        error_report("externally provided fw_cfg item names "
+                     "must be prefixed with \"opt/\"");
+        return -1;
     }
     if (nonempty_str(str)) {
         size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
-- 
MST

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 13:55 [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/ Michael S. Tsirkin
@ 2016-03-15 14:14 ` Paolo Bonzini
  2016-03-15 14:25   ` Gerd Hoffmann
  2016-03-15 14:25   ` Michael S. Tsirkin
  0 siblings, 2 replies; 12+ messages in thread
From: Paolo Bonzini @ 2016-03-15 14:14 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Corey Minyard, Gerd Hoffmann



On 15/03/2016 14:55, Michael S. Tsirkin wrote:
> Allowing arbitary file names on command line is setting us up for
> failure: future guests will look for a specific QEMU-specified name and
> will get confused finding a user file there.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Too bad for the user.

I think we have already gone through this discussion.

Paolo

> ---
>  vl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/vl.c b/vl.c
> index 7a28982..5654af6 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2321,6 +2321,7 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
>      if (strncmp(name, "opt/", 4) != 0) {
> -        error_report("warning: externally provided fw_cfg item names "
> -                     "should be prefixed with \"opt/\"");
> +        error_report("externally provided fw_cfg item names "
> +                     "must be prefixed with \"opt/\"");
> +        return -1;
>      }
>      if (nonempty_str(str)) {
>          size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
> 

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:14 ` Paolo Bonzini
@ 2016-03-15 14:25   ` Gerd Hoffmann
  2016-03-15 14:27     ` Michael S. Tsirkin
  2016-03-15 14:25   ` Michael S. Tsirkin
  1 sibling, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2016-03-15 14:25 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Corey Minyard, qemu-devel, Michael S. Tsirkin

On Di, 2016-03-15 at 15:14 +0100, Paolo Bonzini wrote:
> 
> On 15/03/2016 14:55, Michael S. Tsirkin wrote:
> > Allowing arbitary file names on command line is setting us up for
> > failure: future guests will look for a specific QEMU-specified name and
> > will get confused finding a user file there.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Too bad for the user.
> 
> I think we have already gone through this discussion.

Indeed, we discussed that before.

If users ignore the warning it's their fault.

Being able to set entries outside opt/ can be useful for debugging and
development purposes, this is the reason it is a warning only and not a
hard error.

cheers,
  Gerd

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:14 ` Paolo Bonzini
  2016-03-15 14:25   ` Gerd Hoffmann
@ 2016-03-15 14:25   ` Michael S. Tsirkin
  2016-03-15 14:46     ` Gerd Hoffmann
  2016-03-15 14:54     ` Paolo Bonzini
  1 sibling, 2 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2016-03-15 14:25 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Corey Minyard, qemu-devel, Gerd Hoffmann

On Tue, Mar 15, 2016 at 03:14:21PM +0100, Paolo Bonzini wrote:
> 
> 
> On 15/03/2016 14:55, Michael S. Tsirkin wrote:
> > Allowing arbitary file names on command line is setting us up for
> > failure: future guests will look for a specific QEMU-specified name and
> > will get confused finding a user file there.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Too bad for the user.

Why, because we trapped the user by allowing this
and violating our own compatibility rules?
Because user did not notice the warning?
Do you look at all warnings all your software prints?
What if user uses some tool to build the command line?

consider mem-path - for years we printed a warning if
it's not on hugetlbfs. It worked and users just ignored it.

> I think we have already gone through this discussion.

So now Corey basically is prevented from sorting sanely
because command line might not start with opt/

This is interfering with development instead of enabling it.

If it is really super important for development, add some
option "x-unsupported-fw-cfg" for developers to play with.
Don't allow such things by default, it's a trap.


> Paolo
> 
> > ---
> >  vl.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/vl.c b/vl.c
> > index 7a28982..5654af6 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -2321,6 +2321,7 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
> >      if (strncmp(name, "opt/", 4) != 0) {
> > -        error_report("warning: externally provided fw_cfg item names "
> > -                     "should be prefixed with \"opt/\"");
> > +        error_report("externally provided fw_cfg item names "
> > +                     "must be prefixed with \"opt/\"");
> > +        return -1;
> >      }
> >      if (nonempty_str(str)) {
> >          size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
> > 

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:25   ` Gerd Hoffmann
@ 2016-03-15 14:27     ` Michael S. Tsirkin
  0 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2016-03-15 14:27 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Paolo Bonzini, qemu-devel, Corey Minyard

On Tue, Mar 15, 2016 at 03:25:01PM +0100, Gerd Hoffmann wrote:
> On Di, 2016-03-15 at 15:14 +0100, Paolo Bonzini wrote:
> > 
> > On 15/03/2016 14:55, Michael S. Tsirkin wrote:
> > > Allowing arbitary file names on command line is setting us up for
> > > failure: future guests will look for a specific QEMU-specified name and
> > > will get confused finding a user file there.
> > > 
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > Too bad for the user.
> > 
> > I think we have already gone through this discussion.
> 
> Indeed, we discussed that before.
> 
> If users ignore the warning it's their fault.

Everyone ignores warnings. So it's user's fault for using QEMU.

> Being able to set entries outside opt/ can be useful for debugging and
> development purposes, this is the reason it is a warning only and not a
> hard error.
> 
> cheers,
>   Gerd

Add an unsupported flag there then. We have the rule that
flags starting with x- are for internal purposes, use that.
"x-unsupported-fw-cfg"? Don't trap users into
using a feature and then blaming them.

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:25   ` Michael S. Tsirkin
@ 2016-03-15 14:46     ` Gerd Hoffmann
  2016-03-15 14:54       ` Michael S. Tsirkin
  2016-03-15 14:54     ` Paolo Bonzini
  1 sibling, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2016-03-15 14:46 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Paolo Bonzini, qemu-devel, Corey Minyard

  Hi,

> > I think we have already gone through this discussion.
> 
> So now Corey basically is prevented from sorting sanely
> because command line might not start with opt/

Hmm?  There are no guarantees whatsoever if the user used the command
line for entries outside /opt.

Beside that the "sort everything lexical for 2.6+" approach will work
fine.  I think it is more robust and I suspect we will have less hassle
with it long-term.

cheers,
  Gerd

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:46     ` Gerd Hoffmann
@ 2016-03-15 14:54       ` Michael S. Tsirkin
  2016-03-15 15:03         ` Gerd Hoffmann
  0 siblings, 1 reply; 12+ messages in thread
From: Michael S. Tsirkin @ 2016-03-15 14:54 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Paolo Bonzini, qemu-devel, Corey Minyard

On Tue, Mar 15, 2016 at 03:46:35PM +0100, Gerd Hoffmann wrote:
>   Hi,
> 
> > > I think we have already gone through this discussion.
> > 
> > So now Corey basically is prevented from sorting sanely
> > because command line might not start with opt/
> 
> Hmm?  There are no guarantees whatsoever if the user used the command
> line for entries outside /opt.
> 
> Beside that the "sort everything lexical for 2.6+" approach will work
> fine.  I think it is more robust and I suspect we will have less hassle
> with it long-term.
> 
> cheers,
>   Gerd

OK so use built-in order with fallback on lexical, make built-in order
empty for 2.6+.

Is that fine with you?

-- 
MST

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:25   ` Michael S. Tsirkin
  2016-03-15 14:46     ` Gerd Hoffmann
@ 2016-03-15 14:54     ` Paolo Bonzini
  2016-03-15 14:58       ` Michael S. Tsirkin
  1 sibling, 1 reply; 12+ messages in thread
From: Paolo Bonzini @ 2016-03-15 14:54 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Corey Minyard, qemu-devel, Gerd Hoffmann



On 15/03/2016 15:25, Michael S. Tsirkin wrote:
> Do you look at all warnings all your software prints?

Yes.  I also try to understand them, and if they seem useless I propose
a patch upstream.

> What if user uses some tool to build the command line?
> 
> consider mem-path - for years we printed a warning if
> it's not on hugetlbfs. It worked and users just ignored it.

That was a bad warning though.  There was no reason to warn.

It was also the smallest problem with the original hugetlbfs patches.

> So now Corey basically is prevented from sorting sanely
> because command line might not start with opt/

Can you explain?

Paolo

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:54     ` Paolo Bonzini
@ 2016-03-15 14:58       ` Michael S. Tsirkin
  2016-03-17  1:31         ` Corey Minyard
  0 siblings, 1 reply; 12+ messages in thread
From: Michael S. Tsirkin @ 2016-03-15 14:58 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Corey Minyard, qemu-devel, Gerd Hoffmann

On Tue, Mar 15, 2016 at 03:54:36PM +0100, Paolo Bonzini wrote:
> 
> 
> On 15/03/2016 15:25, Michael S. Tsirkin wrote:
> > Do you look at all warnings all your software prints?
> 
> Yes.  I also try to understand them, and if they seem useless I propose
> a patch upstream.
> 
> > What if user uses some tool to build the command line?
> > 
> > consider mem-path - for years we printed a warning if
> > it's not on hugetlbfs. It worked and users just ignored it.
> 
> That was a bad warning though.  There was no reason to warn.
> 
> It was also the smallest problem with the original hugetlbfs patches.
> 
> > So now Corey basically is prevented from sorting sanely
> > because command line might not start with opt/
> 
> Can you explain?
> 
> Paolo

Ask Corey:
http://thread.gmane.org/gmane.comp.emulators.qemu/400540/focus=400799


-- 
MST

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:54       ` Michael S. Tsirkin
@ 2016-03-15 15:03         ` Gerd Hoffmann
  2016-03-15 15:05           ` Michael S. Tsirkin
  0 siblings, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2016-03-15 15:03 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Paolo Bonzini, qemu-devel, Corey Minyard

On Di, 2016-03-15 at 16:54 +0200, Michael S. Tsirkin wrote:
> On Tue, Mar 15, 2016 at 03:46:35PM +0100, Gerd Hoffmann wrote:
> >   Hi,
> > 
> > > > I think we have already gone through this discussion.
> > > 
> > > So now Corey basically is prevented from sorting sanely
> > > because command line might not start with opt/
> > 
> > Hmm?  There are no guarantees whatsoever if the user used the command
> > line for entries outside /opt.
> > 
> > Beside that the "sort everything lexical for 2.6+" approach will work
> > fine.  I think it is more robust and I suspect we will have less hassle
> > with it long-term.
> > 
> > cheers,
> >   Gerd
> 
> OK so use built-in order with fallback on lexical,

I would just call smbios init from the old location for old machine
types instead of adding code for the built-in sort order ...

cheers,
  Gerd

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 15:03         ` Gerd Hoffmann
@ 2016-03-15 15:05           ` Michael S. Tsirkin
  0 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2016-03-15 15:05 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Paolo Bonzini, qemu-devel, Corey Minyard

On Tue, Mar 15, 2016 at 04:03:23PM +0100, Gerd Hoffmann wrote:
> On Di, 2016-03-15 at 16:54 +0200, Michael S. Tsirkin wrote:
> > On Tue, Mar 15, 2016 at 03:46:35PM +0100, Gerd Hoffmann wrote:
> > >   Hi,
> > > 
> > > > > I think we have already gone through this discussion.
> > > > 
> > > > So now Corey basically is prevented from sorting sanely
> > > > because command line might not start with opt/
> > > 
> > > Hmm?  There are no guarantees whatsoever if the user used the command
> > > line for entries outside /opt.
> > > 
> > > Beside that the "sort everything lexical for 2.6+" approach will work
> > > fine.  I think it is more robust and I suspect we will have less hassle
> > > with it long-term.
> > > 
> > > cheers,
> > >   Gerd
> > 
> > OK so use built-in order with fallback on lexical,
> 
> I would just call smbios init from the old location for old machine
> types instead of adding code for the built-in sort order ...
> 
> cheers,
>   Gerd

That's too fragile. This time I caught the code reordering
but I might not notice it the next time.

-- 
MST

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

* Re: [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/
  2016-03-15 14:58       ` Michael S. Tsirkin
@ 2016-03-17  1:31         ` Corey Minyard
  0 siblings, 0 replies; 12+ messages in thread
From: Corey Minyard @ 2016-03-17  1:31 UTC (permalink / raw)
  To: Michael S. Tsirkin, Paolo Bonzini; +Cc: qemu-devel, Gerd Hoffmann

On 03/15/2016 09:58 AM, Michael S. Tsirkin wrote:
> On Tue, Mar 15, 2016 at 03:54:36PM +0100, Paolo Bonzini wrote:
>>
>> On 15/03/2016 15:25, Michael S. Tsirkin wrote:
>>> Do you look at all warnings all your software prints?
>> Yes.  I also try to understand them, and if they seem useless I propose
>> a patch upstream.
>>
>>> What if user uses some tool to build the command line?
>>>
>>> consider mem-path - for years we printed a warning if
>>> it's not on hugetlbfs. It worked and users just ignored it.
>> That was a bad warning though.  There was no reason to warn.
>>
>> It was also the smallest problem with the original hugetlbfs patches.
>>
>>> So now Corey basically is prevented from sorting sanely
>>> because command line might not start with opt/
>> Can you explain?
>>
>> Paolo
> Ask Corey:
> http://thread.gmane.org/gmane.comp.emulators.qemu/400540/focus=400799
>
>
I think what Paulo is saying is that if you don't use /opt, then all bets
are off whether it works properly.  You were warned and ignored it.

I can go either way with this, you can enforce it (which seems like
the safer route to me) or you can just say that it may not work right
if you don't use /opt.

With the new patch I just posted it won't actually make any difference.
It doesn't look at file names for some things, that ended up not working
because in at least one situation the same file name would end up
in different places depending on the situation, and the order of some
things vary depending on the order the user lists them.

(The one I found was that if you have a pc-0.11 or earlier, if you have
a PCI VGA card it ends up adding a fw_cfg item for the ROM when
VGA is initialized.  If you have an ISA VGA card, it will have the same
file name but will end up where device initialization occurs.)

The solution I ended up with was a fixed specified order, but in
certain sections (VGA, NIC, user added, and devices) they will be
ordered by when they were inserted.

-corey

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

end of thread, other threads:[~2016-03-17  1:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15 13:55 [Qemu-devel] [PATCH] vl.c: disallow command line fw cfg without opt/ Michael S. Tsirkin
2016-03-15 14:14 ` Paolo Bonzini
2016-03-15 14:25   ` Gerd Hoffmann
2016-03-15 14:27     ` Michael S. Tsirkin
2016-03-15 14:25   ` Michael S. Tsirkin
2016-03-15 14:46     ` Gerd Hoffmann
2016-03-15 14:54       ` Michael S. Tsirkin
2016-03-15 15:03         ` Gerd Hoffmann
2016-03-15 15:05           ` Michael S. Tsirkin
2016-03-15 14:54     ` Paolo Bonzini
2016-03-15 14:58       ` Michael S. Tsirkin
2016-03-17  1:31         ` Corey Minyard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.