Skip to contentSkip to conversation

fix strict boot regression

PATCH In review Amos Kong 3 participants 7 messages Dec 9, 2013

lore
Share & tools
lore

Amos Kong

author
#0 lore raw

v2 cover fix strict boot regression

parsing of "strict" is wrongly removed, we need it. The first patch fixes a typo.

V2: remove bios.bin change, I just used it for testing (mjt)

Amos Kong (2):
fix a typo of strict option
add parsing of "strict" boot parameter

 vl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
author
#1 lore raw

PATCH v2 1/2 fix a typo of strict option

The type of "strict" should be bool.

---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +1 -1
index b0399de..12fe1f7 100644
@@ -461,7 +461,7 @@ static QemuOptsList qemu_boot_opts = {
             .type = QEMU_OPT_STRING,
         }, {
             .name = "strict",
-            .type = QEMU_OPT_STRING,
+            .type = QEMU_OPT_BOOL,
         },
         { /*End of list */ }
     },
Signature · 1 line
1.7.1
#2 lore raw

Re: [Qemu-devel] [PATCH v2 1/2] fix a typo of strict option

Quoted 12 lines · Amos Kong

The type of "strict" should be bool.

---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +0 -0
index b0399de..12fe1f7 100644

vl.c static QemuOptsList qemu_boot_opts = { · line 467

Quoted 8 lines
vl.c +1 -1
@@ -461,7 +461,7 @@ static QemuOptsList qemu_boot_opts = {
             .type = QEMU_OPT_STRING,
         }, {
             .name = "strict",
-            .type = QEMU_OPT_STRING,
+            .type = QEMU_OPT_BOOL,
         },
         { /*End of list */ }
     },

No, this isn't just a typo fix, it's an interface change. It's not immediately obvious whether it's okay.

-boot parameter 'strict' appeared in commit c8a6ae8. It was declared QEMU_OPT_STRING, but the code using the value rejected anything but 'on' and 'off'. This shipped in 1.5.0.

Commit 6ef4716 accidentally dropped the code using the value of 'strict'. Since then, any parameter value is accepted and silently ignored. Shipped in 1.6.0.

Your change restores the "reject anything but 'on' and 'off'" part (the "use the value" part gets restored in the next patch). Okay, because the values erroneously accepted in the meantime didn't do anything.

author
#3 lore raw

Re: [Qemu-devel] [PATCH v2 1/2] fix a typo of strict option

Quoted 9 lines · Markus Armbruster
Quoted 7 lines · Amos Kong

The type of "strict" should be bool.

---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 16 lines

vl.c static QemuOptsList qemu_boot_opts = { · line 467

Quoted 13 lines
vl.c +1 -1
index b0399de..12fe1f7 100644
@@ -461,7 +461,7 @@ static QemuOptsList qemu_boot_opts = {
             .type = QEMU_OPT_STRING,
         }, {
             .name = "strict",
-            .type = QEMU_OPT_STRING,
+            .type = QEMU_OPT_BOOL,
         },
         { /*End of list */ }
     },

No, this isn't just a typo fix, it's an interface change. It's not immediately obvious whether it's okay.

You are correct, it's not a typo, menu's type was also changed from STRING to BOOL. We can just process strict as menu.

Quoted 11 lines

-boot parameter 'strict' appeared in commit c8a6ae8. It was declared QEMU_OPT_STRING, but the code using the value rejected anything but 'on' and 'off'. This shipped in 1.5.0.

Commit 6ef4716 accidentally dropped the code using the value of 'strict'. Since then, any parameter value is accepted and silently ignored. Shipped in 1.6.0.

Your change restores the "reject anything but 'on' and 'off'" part (the "use the value" part gets restored in the next patch). Okay, because the values erroneously accepted in the meantime didn't do anything.

Thanks your explanation :)

Signature · 1 line
			Amos.
author
#4 lore raw

PATCH v2 2/2 add parsing of "strict" boot parameter

In reply to Amos Kong

Commit 6ef4716cecdfa1b3794c1a33edba9840e1aa6b5f cleaned up the parse code of boot parameter, parse code of "strict" wasn't re-implemented, it caused that strict boot feature is always disabled.

---
 vl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
vl.c +1 -0
index 12fe1f7..ae6d0c6 100644
@@ -4074,6 +4074,7 @@ int main(int argc, char **argv, char **envp)
         }
 
         boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu);
+        boot_strict = qemu_opt_get_bool(opts, "strict", false);
     }
 
     if (!kernel_cmdline) {
Signature · 1 line
1.7.1
#5 lore raw

Re: [Qemu-devel] [PATCH v2 2/2] add parsing of "strict" boot parameter

Quoted 15 lines · Amos Kong

Commit 6ef4716cecdfa1b3794c1a33edba9840e1aa6b5f cleaned up the parse code of boot parameter, parse code of "strict" wasn't re-implemented, it caused that strict boot feature is always disabled.

---
 vl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
vl.c +0 -0
index 12fe1f7..ae6d0c6 100644

vl.c int main(int argc, char **argv, char **envp) · line 4080

Quoted 7 lines
vl.c +1 -0
@@ -4074,6 +4074,7 @@ int main(int argc, char **argv, char **envp)
         }
 
         boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu);
+        boot_strict = qemu_opt_get_bool(opts, "strict", false);
     }
 
     if (!kernel_cmdline) {

This restores the second half of what got dropped accidentally in commit 6ef4716. Suggest to squash the two halves together, and rephrase the commit message to more clearly mark it as bug fix. Something like this:

Fix -boot strict regressed in commit 6ef4716

Commit 6ef4716 cleaned up parsing of -boot option argument, but accidentally dropped parameter strict. It should have been updated exactly like parameter menu. Do that.

I apologize for the screwup. It took me 120 days to get my patch in, and I botched the final rebase's conflict resolution.

Reviewed-by on the v2 series
#6 lore raw
In reply to Amos Kong
Quoted 11 lines · Amos Kong

parsing of "strict" is wrongly removed, we need it. The first patch fixes a typo.

V2: remove bios.bin change, I just used it for testing (mjt)

Amos Kong (2):
fix a typo of strict option
add parsing of "strict" boot parameter

 vl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

I think it is okay to go to qemu-trivial (both patches are fine to my eyes). I queued them up for now, will roll back if there's any objections. At any rate,

Note that boot_strict can be made static since it isn't used anywhere else. I'll queue this change too.

Thanks,

/mjt