[kernel] r19917 - in dists/sid/linux/debian: . config patches patches/bugfix/all

Ben Hutchings benh at alioth.debian.org
Tue Mar 19 02:29:01 UTC 2013


Author: benh
Date: Tue Mar 19 02:29:01 2013
New Revision: 19917

Log:
kmsg_dump: Only dump kernel log in error cases (Closes: #703386)

- kexec: remove KMSG_DUMP_KEXEC
- kmsg_dump: don't run on non-error paths by default

Ignore ABI change to kmsg_dump_{,un}register(); I don't think these
should be used from OOT and codesearch doesn't find any users.

Added:
   dists/sid/linux/debian/patches/bugfix/all/kexec-remove-KMSG_DUMP_KEXEC.patch
   dists/sid/linux/debian/patches/bugfix/all/kmsg_dump-don-t-run-on-non-error-paths-by-default.patch
Modified:
   dists/sid/linux/debian/changelog
   dists/sid/linux/debian/config/defines
   dists/sid/linux/debian/patches/series

Modified: dists/sid/linux/debian/changelog
==============================================================================
--- dists/sid/linux/debian/changelog	Tue Mar 19 01:03:35 2013	(r19916)
+++ dists/sid/linux/debian/changelog	Tue Mar 19 02:29:01 2013	(r19917)
@@ -68,6 +68,9 @@
   * efi: Ensure efivars is loaded on EFI systems (Closes: #703363)
     - [x86] Use a platform device to trigger loading of efivars
     - [ia64] Change EFI_VARS from module to built-in
+  * kmsg_dump: Only dump kernel log in error cases (Closes: #703386)
+    - kexec: remove KMSG_DUMP_KEXEC
+    - kmsg_dump: don't run on non-error paths by default
 
  -- Ben Hutchings <ben at decadent.org.uk>  Wed, 27 Feb 2013 03:48:30 +0000
 

Modified: dists/sid/linux/debian/config/defines
==============================================================================
--- dists/sid/linux/debian/config/defines	Tue Mar 19 01:03:35 2013	(r19916)
+++ dists/sid/linux/debian/config/defines	Tue Mar 19 02:29:01 2013	(r19917)
@@ -41,6 +41,9 @@
  module:drivers/staging/*
 # Private to this family of drivers
  module:drivers/net/wireless/rtlwifi/*
+# Should not be used from OOT
+ kmsg_dump_register
+ kmsg_dump_unregister
 
 [base]
 arches:

Added: dists/sid/linux/debian/patches/bugfix/all/kexec-remove-KMSG_DUMP_KEXEC.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux/debian/patches/bugfix/all/kexec-remove-KMSG_DUMP_KEXEC.patch	Tue Mar 19 02:29:01 2013	(r19917)
@@ -0,0 +1,100 @@
+From: WANG Cong <xiyou.wangcong at gmail.com>
+Date: Thu, 12 Jan 2012 17:20:11 -0800
+Subject: kexec: remove KMSG_DUMP_KEXEC
+
+commit a3dd3323058d281abd584b15ad4c5b65064d7a61 upstream.
+
+KMSG_DUMP_KEXEC is useless because we already save kernel messages inside
+/proc/vmcore, and it is unsafe to allow modules to do other stuffs in a
+crash dump scenario.
+
+[akpm at linux-foundation.org: fix powerpc build]
+Signed-off-by: WANG Cong <xiyou.wangcong at gmail.com>
+Reported-by: Vivek Goyal <vgoyal at redhat.com>
+Acked-by: Vivek Goyal <vgoyal at redhat.com>
+Acked-by: Jarod Wilson <jarod at redhat.com>
+Cc: "Eric W. Biederman" <ebiederm at xmission.com>
+Cc: KOSAKI Motohiro <kosaki.motohiro at jp.fujitsu.com>
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ arch/powerpc/platforms/pseries/nvram.c |    1 -
+ drivers/char/ramoops.c                 |    3 +--
+ drivers/mtd/mtdoops.c                  |    3 +--
+ include/linux/kmsg_dump.h              |    1 -
+ kernel/kexec.c                         |    3 ---
+ 5 files changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
+index 330a57b..36f957f 100644
+--- a/arch/powerpc/platforms/pseries/nvram.c
++++ b/arch/powerpc/platforms/pseries/nvram.c
+@@ -638,7 +638,6 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
+ 		/* These are almost always orderly shutdowns. */
+ 		return;
+ 	case KMSG_DUMP_OOPS:
+-	case KMSG_DUMP_KEXEC:
+ 		break;
+ 	case KMSG_DUMP_PANIC:
+ 		panicking = true;
+diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
+index 7c7f42a1f8..feda90c 100644
+--- a/drivers/char/ramoops.c
++++ b/drivers/char/ramoops.c
+@@ -83,8 +83,7 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
+ 	struct timeval timestamp;
+ 
+ 	if (reason != KMSG_DUMP_OOPS &&
+-	    reason != KMSG_DUMP_PANIC &&
+-	    reason != KMSG_DUMP_KEXEC)
++	    reason != KMSG_DUMP_PANIC)
+ 		return;
+ 
+ 	/* Only dump oopses if dump_oops is set */
+diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
+index db8e827..3ce99e0 100644
+--- a/drivers/mtd/mtdoops.c
++++ b/drivers/mtd/mtdoops.c
+@@ -315,8 +315,7 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper,
+ 	char *dst;
+ 
+ 	if (reason != KMSG_DUMP_OOPS &&
+-	    reason != KMSG_DUMP_PANIC &&
+-	    reason != KMSG_DUMP_KEXEC)
++	    reason != KMSG_DUMP_PANIC)
+ 		return;
+ 
+ 	/* Only dump oopses if dump_oops is set */
+diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
+index ee0c952..fee6631 100644
+--- a/include/linux/kmsg_dump.h
++++ b/include/linux/kmsg_dump.h
+@@ -18,7 +18,6 @@
+ enum kmsg_dump_reason {
+ 	KMSG_DUMP_OOPS,
+ 	KMSG_DUMP_PANIC,
+-	KMSG_DUMP_KEXEC,
+ 	KMSG_DUMP_RESTART,
+ 	KMSG_DUMP_HALT,
+ 	KMSG_DUMP_POWEROFF,
+diff --git a/kernel/kexec.c b/kernel/kexec.c
+index 090ee10..20ed47a 100644
+--- a/kernel/kexec.c
++++ b/kernel/kexec.c
+@@ -32,7 +32,6 @@
+ #include <linux/console.h>
+ #include <linux/vmalloc.h>
+ #include <linux/swap.h>
+-#include <linux/kmsg_dump.h>
+ #include <linux/syscore_ops.h>
+ 
+ #include <asm/page.h>
+@@ -1094,8 +1093,6 @@ void crash_kexec(struct pt_regs *regs)
+ 		if (kexec_crash_image) {
+ 			struct pt_regs fixed_regs;
+ 
+-			kmsg_dump(KMSG_DUMP_KEXEC);
+-
+ 			crash_setup_regs(&fixed_regs, regs);
+ 			crash_save_vmcoreinfo();
+ 			machine_crash_shutdown(&fixed_regs);

Added: dists/sid/linux/debian/patches/bugfix/all/kmsg_dump-don-t-run-on-non-error-paths-by-default.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux/debian/patches/bugfix/all/kmsg_dump-don-t-run-on-non-error-paths-by-default.patch	Tue Mar 19 02:29:01 2013	(r19917)
@@ -0,0 +1,105 @@
+From: Matthew Garrett <mjg at redhat.com>
+Date: Mon, 5 Mar 2012 14:59:10 -0800
+Subject: kmsg_dump: don't run on non-error paths by default
+
+commit c22ab332902333f83766017478c1ef6607ace681 upstream.
+
+Since commit 04c6862c055f ("kmsg_dump: add kmsg_dump() calls to the
+reboot, halt, poweroff and emergency_restart paths"), kmsg_dump() gets
+run on normal paths including poweroff and reboot.
+
+This is less than ideal given pstore implementations that can only
+represent single backtraces, since a reboot may overwrite a stored oops
+before it's been picked up by userspace.  In addition, some pstore
+backends may have low performance and provide a significant delay in
+reboot as a result.
+
+This patch adds a printk.always_kmsg_dump kernel parameter (which can also
+be changed from userspace).  Without it, the code will only be run on
+failure paths rather than on normal paths.  The option can be enabled in
+environments where there's a desire to attempt to audit whether or not a
+reboot was cleanly requested or not.
+
+Signed-off-by: Matthew Garrett <mjg at redhat.com>
+Acked-by: Seiji Aguchi <seiji.aguchi at hds.com>
+Cc: Seiji Aguchi <seiji.aguchi at hds.com>
+Cc: David Woodhouse <dwmw2 at infradead.org>
+Cc: Marco Stornelli <marco.stornelli at gmail.com>
+Cc: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
+Cc: KOSAKI Motohiro <kosaki.motohiro at jp.fujitsu.com>
+Cc: Vivek Goyal <vgoyal at redhat.com>
+Cc: Don Zickus <dzickus at redhat.com>
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ Documentation/kernel-parameters.txt |    6 ++++++
+ include/linux/kmsg_dump.h           |    9 +++++++--
+ kernel/printk.c                     |    6 ++++++
+ 3 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
+index 033d4e6..d99fd9c 100644
+--- a/Documentation/kernel-parameters.txt
++++ b/Documentation/kernel-parameters.txt
+@@ -2211,6 +2211,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
+ 
+ 			default: off.
+ 
++	printk.always_kmsg_dump=
++			Trigger kmsg_dump for cases other than kernel oops or
++			panics
++			Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
++			default: disabled
++
+ 	printk.time=	Show timing data prefixed to each printk message line
+ 			Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
+ 
+diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
+index fee6631..35f7237 100644
+--- a/include/linux/kmsg_dump.h
++++ b/include/linux/kmsg_dump.h
+@@ -15,13 +15,18 @@
+ #include <linux/errno.h>
+ #include <linux/list.h>
+ 
++/*
++ * Keep this list arranged in rough order of priority. Anything listed after
++ * KMSG_DUMP_OOPS will not be logged by default unless printk.always_kmsg_dump
++ * is passed to the kernel.
++ */
+ enum kmsg_dump_reason {
+-	KMSG_DUMP_OOPS,
+ 	KMSG_DUMP_PANIC,
++	KMSG_DUMP_OOPS,
++	KMSG_DUMP_EMERG,
+ 	KMSG_DUMP_RESTART,
+ 	KMSG_DUMP_HALT,
+ 	KMSG_DUMP_POWEROFF,
+-	KMSG_DUMP_EMERG,
+ };
+ 
+ /**
+diff --git a/kernel/printk.c b/kernel/printk.c
+index 13c0a11..32690a0 100644
+--- a/kernel/printk.c
++++ b/kernel/printk.c
+@@ -702,6 +702,9 @@ static bool printk_time = 0;
+ #endif
+ module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
+ 
++static bool always_kmsg_dump;
++module_param_named(always_kmsg_dump, always_kmsg_dump, bool, S_IRUGO | S_IWUSR);
++
+ /* Check if we have any console registered that can be called early in boot. */
+ static int have_callable_console(void)
+ {
+@@ -1732,6 +1735,9 @@ void kmsg_dump(enum kmsg_dump_reason reason)
+ 	unsigned long l1, l2;
+ 	unsigned long flags;
+ 
++	if ((reason > KMSG_DUMP_OOPS) && !always_kmsg_dump)
++		return;
++
+ 	/* Theoretically, the log could move on after we do this, but
+ 	   there's not a lot we can do about that. The new messages
+ 	   will overwrite the start of what we dump. */

Modified: dists/sid/linux/debian/patches/series
==============================================================================
--- dists/sid/linux/debian/patches/series	Tue Mar 19 01:03:35 2013	(r19916)
+++ dists/sid/linux/debian/patches/series	Tue Mar 19 02:29:01 2013	(r19917)
@@ -616,3 +616,5 @@
 debian/pps-avoid-abi-change-in-3.2.40.patch
 bugfix/x86/drm-i915-Unconditionally-initialise-the-interrupt-wo.patch
 debian/efi-autoload-efivars.patch
+bugfix/all/kexec-remove-KMSG_DUMP_KEXEC.patch
+bugfix/all/kmsg_dump-don-t-run-on-non-error-paths-by-default.patch



More information about the Kernel-svn-changes mailing list