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  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 Oct 2009 17:39:40 +0900
From:	Jin Dongming <>
To:	LKLM <>
CC:	Vivek Goyal <>,
	Kenji Kaneshige <>,
	Hidetoshi Seto <>
Subject: [PATCH] [RFC][Patch x86-tip] add notifier before kdump

When the kernel is going on panic, there are three groups of people
who want to do something for themselves at that time:
    1. Only do the work for notifying
    2. Only do the work for kdump
    3. Want to do both of the above, notifying and kdump

The first and second have been done well on current kernel, but we
can not satisfy 3rd when kdump is used, because notify_die() is located
after crash_kexec(). So I think we can do some work to make it working
well. And I am also the person who stand in the third group.

In our PC-cluster, there are two nodes working together, one is running
and the other one is on standby mode. When the running one is going
on panic, we hope the works listed as following would be done:
    1. Before the running kernel is going on panic, the node on standby
       mode should be notified firstly.
    2. After the notified work is done, the panic kernel startup on the
       second kernel to get kdump.
But the current kernel could not do them all.

For resolving this problem,I made this patch.
In my patch, because I don't want to give impact to both of all, notifying
and kdump, I do following work:
    1. I add crash_notifier instead of the existing notify_die().
       So the original functionality of notify_die() will not be changed. I
       made all of the work done just before kdump will be got.
    2. I add a switch to turn on/off crash_notifier.
       This switch could be turned on/off according to your request. For
       example, when kdump is only required to be done, the crash_notifier is
       not need any more, so the switch could be turned off.
       Also there will be not impact to the second kernel. Because it is valid
       only when the flag for crash_notifier is set via a parameter of kernel.

This patch is not tested on SH and Power PC.

Signed-off-by: Akiyama, Nobuyuki <>
Signed-off-by: Jin Dongming <>
 include/linux/kexec.h |    2 ++
 kernel/kexec.c        |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index adc34f2..c50158c 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -9,6 +9,7 @@
 #include <linux/ioport.h>
 #include <linux/elfcore.h>
 #include <linux/elf.h>
+#include <linux/notifier.h>
 #include <asm/kexec.h>
 /* Verify architecture specific macros are defined */
@@ -158,6 +159,7 @@ unsigned long paddr_vmcoreinfo_note(void);
 extern struct kimage *kexec_image;
 extern struct kimage *kexec_crash_image;
+extern struct raw_notifier_head crash_notifier_list;
 #ifndef kexec_flush_icache_page
 #define kexec_flush_icache_page(page)
diff --git a/kernel/kexec.c b/kernel/kexec.c
index f336e21..147f22d 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -31,6 +31,8 @@
 #include <linux/cpu.h>
 #include <linux/console.h>
 #include <linux/vmalloc.h>
+#include <linux/module.h>
+#include <linux/notifier.h>
 #include <asm/page.h>
 #include <asm/uaccess.h>
@@ -38,6 +40,10 @@
 #include <asm/system.h>
 #include <asm/sections.h>
+/* crash notifier list */
 /* Per cpu memory for storing cpu states in case of system crash. */
 note_buf_t* crash_notes;
@@ -1060,6 +1066,14 @@ asmlinkage long compat_sys_kexec_load(unsigned long entry,
+static int		crash_notifier_valid		__read_mostly;
+static void notify_crash(void)
+	if (crash_notifier_valid)
+		raw_notifier_call_chain(&crash_notifier_list, 0, 0);
 void crash_kexec(struct pt_regs *regs)
 	/* Take the kexec_mutex here to prevent sys_kexec_load
@@ -1076,6 +1090,7 @@ void crash_kexec(struct pt_regs *regs)
 			crash_setup_regs(&fixed_regs, regs);
+			notify_crash();
@@ -1502,3 +1517,12 @@ int kernel_kexec(void)
 	return error;
+static int __init kexec_crash_notifier_valid(char *str)
+	crash_notifier_valid = 1;
+	return 1;
+__setup("crash_notifier", kexec_crash_notifier_valid);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists