lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 27 Dec 2008 23:42:53 +1030
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Hugh Dickins <hugh@...itas.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Yinghai Lu <yinghai@...nel.org>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Paul Mackerras <paulus@...ba.org>,
	Benjamin Herrenschmidt <benh@....ibm.com>
Subject: Re: linux-next: parsing mem=700M broken

On Thursday 25 December 2008 01:14:35 Hugh Dickins wrote:
> But (of course: it's a patch to arch/x86) doesn't help at all on
> ppc64; and I presume other architectures also remain broken...

Confirmed ppc64.  But it's broken in a *different* way.

Whereas most archs called parse_early_param from setup_arch, powerpc
does it before start_kernel.  So instead of moving parsing earlier,
my patch actually moved it later for powerpc.

Too late, for mem=.

Rather than try to untangle the powerpc boot process (most archs would
do most of this in setup_arch), I think I have to expose the parser
again so they can call it:

commit 25bf48b74b9fb23b347d00656b604f9e55c72183
Author: Rusty Russell <rusty@...tcorp.com.au>
Date:   Sat Dec 27 23:40:37 2008 +1030

    Fix powerpc (tested on ppc64) command line handling.
    Powerpc used to call parse_early_param() really early; the change made
    it too late.  Put it back.

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d36cbd0..e5f2387 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -32,6 +32,7 @@
 #include <linux/debugfs.h>
 #include <linux/irq.h>
 #include <linux/lmb.h>
+#include <linux/start_kernel.h>
 
 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -1188,6 +1189,7 @@ void __init early_init_devtree(void *params)
 
 	/* Save command line for /proc/cmdline and then parse parameters */
 	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
+	parse_early_and_core_params(boot_command_line);
 
 	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
 	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index a237371..52ca63a 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -264,12 +264,6 @@ static void __init exc_lvl_early_init(void)
 #define exc_lvl_early_init()
 #endif
 
-void arch_get_boot_command_line(void)
-{
-	/* FIXME: Get rid of cmd_line in favor of boot_command_line? */
-	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
-}
-
 /* Warning, IO base is not yet inited */
 void __init setup_arch(void)
 {
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 7d25b42..348bc8a 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -502,12 +502,6 @@ static void __init emergency_stack_init(void)
 	}
 }
 
-void arch_get_boot_command_line(void)
-{
-	/* FIXME: Get rid of cmd_line in favor of boot_command_line? */
-	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
-}
-
 /*
  * Called into from start_kernel, after lock_kernel has been called.
  * Initializes bootmem, which is unsed to manage page allocation until
diff --git a/include/linux/start_kernel.h b/include/linux/start_kernel.h
index d3e5f27..347cc95 100644
--- a/include/linux/start_kernel.h
+++ b/include/linux/start_kernel.h
@@ -9,4 +9,7 @@
 
 extern asmlinkage void __init start_kernel(void);
 
+/* Usually called by start_kernel, but some nasty archs need it earlier. */
+void __init parse_early_and_core_params(char *cmdline);
+
 #endif /* _LINUX_START_KERNEL_H */
diff --git a/init/main.c b/init/main.c
index fb00387..ad933ad 100644
--- a/init/main.c
+++ b/init/main.c
@@ -522,6 +522,21 @@ void __init __weak thread_info_cache_init(void)
 {
 }
 
+/* Non-destructive early parse of commandline.  PowerPC calls this early. */
+void __init parse_early_and_core_params(char *cmdline)
+{
+	static bool __initdata done = false;
+
+	if (done)
+		return;
+
+	parse_args("Core and early params", cmdline,
+		   __start___core_param,
+		   __stop___core_param - __start___core_param,
+		   do_early_param, true);
+	done = true;
+}
+
 asmlinkage void __init start_kernel(void)
 {
 	char *static_command_line;
@@ -530,10 +545,7 @@ asmlinkage void __init start_kernel(void)
 	printk(linux_banner);
 
 	arch_get_boot_command_line();
-	parse_args("Core and early params", boot_command_line,
-		   __start___core_param,
-		   __stop___core_param - __start___core_param,
-		   do_early_param, true);
+	parse_early_and_core_params(boot_command_line);
 
 	smp_setup_processor_id();
 
.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ