[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XenPPC] [PATCH] Parse Xen command line properly



We are improperly feeding the entire boot parameter string to Xen's
generic command line parser.  This can have unexpected results when one
of the dom0 parameters, such as console=X, has meaning to the Xen
parser.  First reported by Maria Butrico.

Signed-off-by: Amos Waterland <apw@xxxxxxxxxx>

---

 setup.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff -r 261c458e46af xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Fri Sep 29 18:13:27 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Mon Oct 02 00:17:07 2006 -0400
@@ -279,8 +279,20 @@ static void __init __start_xen(multiboot
     ticks_per_usec = timebase_freq / 1000000ULL;
 
     /* Parse the command-line options. */
-    if ((mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0))
-        cmdline_parse(__va((ulong)mbi->cmdline));
+    if ((mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0)) {
+        char *end, *src = (char *)(ulong)mbi->cmdline;
+        char buff[256];
+
+        end = strstr(src, "--");
+
+        if (end && (end - src < sizeof(buff))) {
+            strlcpy(buff, src, end - src);
+        } else {
+            strlcpy(buff, src, sizeof(buff));
+        }
+
+        cmdline_parse(buff);
+    }
 
     /* We initialise the serial devices very early so we can get debugging. */
     ns16550.io_base = 0x3f8;

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.