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]
Message-Id: <1433848293-5228-1-git-send-email-kuleshovmail@gmail.com>
Date:	Tue,  9 Jun 2015 17:11:33 +0600
From:	Alexander Kuleshov <kuleshovmail@...il.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>
Cc:	Alexander Kuleshov <kuleshovmail@...il.com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Borislav Petkov <bp@...e.de>,
	Mark Rustad <mark.d.rustad@...el.com>,
	Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH v11 3/5] x86/earlyprintk: Allocate early log_buf as early as possible

This patch moves call of the early setup_log_buf from the
arch/x86/kernel/setup.c to the arch/x86/kernel/head{32,64}.c
and updates log_buf with the earlyprintk messages.

We need to do it because without it we will not see earlyprintk
messages in the kernel log.

Signed-off-by: Alexander Kuleshov <kuleshovmail@...il.com>
---
 arch/x86/kernel/head32.c | 6 ++++++
 arch/x86/kernel/head64.c | 5 +++++
 arch/x86/kernel/setup.c  | 3 ---
 kernel/printk/printk.c   | 5 +++++
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 92e8b5f..f28d10f 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -32,2 +32,2 @@ static void __init i386_default_early_setup(void)
 asmlinkage __visible void __init i386_start_kernel(void)
 {
	setup_builtin_cmdline();
+
+	lockdep_init();
+
+	/* Allocate early log buffer */
+	setup_log_buf(1);
+
 	cr4_init_shadow();
 	sanitize_boot_params(&boot_params);
 
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 1e5f064..53662d2 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -174,0 +174,0 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)

 	setup_builtin_cmdline();
 
+	lockdep_init();
+
+	/* Allocate early log buffer */
+	setup_log_buf(1);
+
 	/*
 	 * Load microcode early on BSP.
 	 */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 0aeee0a..edfdb6a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1146,9 +1146,6 @@ void __init setup_arch(char **cmdline_p)
 	if (init_ohci1394_dma_early)
 		init_ohci1394_dma_on_all_controllers();
 #endif
-	/* Allocate bigger log buffer */
-	setup_log_buf(1);
-
 	reserve_initrd();
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_BLK_DEV_INITRD)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index c099b08..d76a032 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1913,6 +1913,7 @@ asmlinkage __visible void early_printk(const char *fmt, ...)
 	va_list ap;
 	char buf[512];
 	int n;
+	printk_func_t vprintk_func;
 
 	if (!early_console)
 		return;
@@ -1922,7 +1923,10 @@ asmlinkage __visible void early_printk(const char *fmt, ...)
 	va_end(ap);
 
 	early_console->write(early_console, buf, n);
+
+	/* Store earlyprintk messages in the log_buf */
+	vprintk_func = this_cpu_read(printk_func);
+	vprintk_func(fmt, ap);
 }
 #endif
 
-- 
2.4.0.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ