[syslinux] [PATCH] com32/lib/syslinux/load_linux.c: cmdline truncated

Bodo Stroesser bstroesser at ts.fujitsu.com
Wed May 19 08:40:04 PDT 2010


Hi,

in syslinux-386, I think I've found a problem in
   com32/lib/syslinux/load_linux.c
that leads to cmdline being truncated unnecessarily when e.g.
linux.c32 is used.

The patch below fixes the problem for me. But I don't know,
whether the patch is safe in all cases. I tried to reproduce
the logic found in runkernel.inc, but I might have missed
something. So, feel free to tell me what's wrong with it.

Please CC me, as I'm not on the list.

Thank you,
Bodo

------------------------------------------------------------

From: Bodo Stroesser <bstroesser at ts.fujitsu.com>

If a com32 modules uses load_linux, this handles long command
lines differently to core programs which include runkernel.inc
Thus linux.c32 loaded under pxelinux.0 truncates the cmdline
for linux 2.6.16 (SLES11) to max. 255 characters while loading
the same kernel from pxelinux.0 directly, cmdline will be truncated
at 2047 characters (+ closing 0).

This patch changes load_linux.c to use the same limits as
runkernel.inc does.

Signed-off-by: Bodo Stroesser <bstroesser at ts.fujitsu.com>
----

--- a/com32/lib/syslinux/load_linux.c	2010-05-18 23:00:11.000000000 +0200
+++ b/com32/lib/syslinux/load_linux.c	2010-05-18 23:10:15.000000000 +0200
@@ -289,8 +289,15 @@ int syslinux_boot_linux(void *kernel_buf
     if (hdr.version < 0x0205 || !(hdr.loadflags & LOAD_HIGH))
 	hdr.relocatable_kernel = 0;
 
-    if (hdr.version < 0x0206)
+    if (hdr.version < 0x0202)
 	hdr.cmdline_max_len = 256;
+    else if (hdr.version < 0x0206)
+	/* if (!(hdr.loadflags & 0x01))
+	 *      hdr.cmdline_max_len = 2048; // protocol limit
+	 * else
+	 *      hdr.cmdline_max_len = 2048; // current kernel buffer size
+	 */
+	hdr.cmdline_max_len = 2048;
 
     if (cmdline_size > hdr.cmdline_max_len) {
 	cmdline_size = hdr.cmdline_max_len;


More information about the Syslinux mailing list