Re: [PATCH] use of uninitialized stack buffer in crl bootldr

From: Yann Dirson <ydirson_at_altern.org>
Date: Tue, 06 May 2008 19:24:52 -0000

<resend>
Looks like yet another mail which was not delivered to the ml.

As requested by Michal, here is some output showing the problem -
unfortunately it is not visible this time, as the junk apparently
results in chars that show up as blank, so Imanually added JUNK where
it appears. You will notice that it prevents the boot because
rdinit=/bin/sh, it does not cause any problem with rdinit=/sbin/init

[...]
boot> set linuxargs console=tty1 console=ttyS0,115200 initrd rdinit=/bin/sh
  setting param <linuxargs> to value <console=tty1 console=ttyS0,115200 initrd rdinit=/bin/sh>
boot> boot addr 0xA0008000 0
[...]
pre unparse setting boot parameters to
console=tty1 console=ttyS0,115200 initrd rdinit=/bin/sh
setting boot parameters to
console=tty1 console=ttyS0,115200 initrd rdinit=/bin/sh JUNK
[...]
[ 3.020000] Freeing init memory: 84K
/bin/sh: Can't open JUNK
[ 3.040000] Kernel panic - not syncing: Attempted to kill init!

</resend>

Hm, here is the patch, sorry :)

It also does a couple of typo fixes in comments.

Index: bootcmds.c
===================================================================
RCS file: /cvs/bootldr/bootcmds.c,v
retrieving revision 1.23
diff -u -r1.23 bootcmds.c
--- bootcmds.c 17 Sep 2003 17:09:57 -0000 1.23
+++ bootcmds.c 29 Apr 2008 20:59:06 -0000
@@ -347,6 +347,8 @@
        putstr("<\r\n");
    }
    
+ bootargs[0] = '\0';
+
    if (nfsroot != NULL) {
      strcat(bootargs, " nfsroot="); strcat(bootargs, nfsroot);
    }
@@ -466,7 +468,9 @@
         putstr("error parsing img_size\r\n");
         return;
     }
-
+
+ bootargs[0] = '\0';
+
     ipaddr = (const char *)param_ipaddr.value;
     serveraddr = (const char *)param_nfs_server_address.value;
     gatewayaddr = (const char *)param_gateway.value;
@@ -500,7 +504,7 @@
 
 #if defined(CONFIG_JFFS)
 
-/* read kernel from jffs2 file */
+/* read kernel from jffs file */
 SUBCOMMAND(boot, jffs, command_boot_jffs, "[boot_file] -- read kernel from jffs2 file (see boot_file param)", BB_RUN_FROM_RAM, 1);
 void command_boot_jffs(int argc, const char **argv)
 {
Index: bootldr.c
===================================================================
RCS file: /cvs/bootldr/bootldr.c,v
retrieving revision 1.209
diff -u -r1.209 bootldr.c
--- bootldr.c 4 May 2004 22:35:42 -0000 1.209
+++ bootldr.c 29 Apr 2008 20:59:08 -0000
@@ -759,8 +759,8 @@
 
 
 
-// this is getting more compliacated, this function will averride any of the
-// args in argstr with tthe args from argv. this will allow you to override the
+// this is getting more compliacated, this function will override any of the
+// args in argstr with the args from argv. this will allow you to override the
 // param linuxargs from the commandline. e.g. init=/myRC will override
 // init=linuxRC from the params.
 void unparseargs(char *argstr, int argc, const char **argv)
Received on Tue May 06 2008 - 15:24:52 EDT

This archive was generated by hypermail 2.2.0 : Thu May 22 2008 - 10:02:50 EDT