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: <1304462080-3358-2-git-send-email-fenghua.yu@intel.com>
Date:	Tue,  3 May 2011 15:34:39 -0700
From:	"Fenghua Yu" <fenghua.yu@...el.com>
To:	"Ingo Molnar" <mingo@...e.hu>,
	"Thomas Gleixner" <tglx@...utronix.de>,
	"H Peter Anvin" <hpa@...or.com>, "Tony Luck" <tony.luck@...el.com>
Cc:	"linux-kernel" <linux-kernel@...r.kernel.org>,
	"Fenghua Yu" <fenghua.yu@...el.com>
Subject: [PATCH 1/2] x86/kernel/cpu/mcheck/mce-inject.c: Add mce inject driver exit

From: Fenghua Yu <fenghua.yu@...el.com>

Gracefully remove mce_inject driver. This avoids rebooting machine if one wants
to release the driver. It makes the driver more useful for debugging mce issues
or debugging the driver itself. And the mce code is more clean and reasonable.

Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
Acked-by: Tony Luck <tony.luck@...el.com>
---
 arch/x86/kernel/cpu/mcheck/mce-inject.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index 0ed633c..9966a61 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -179,7 +179,7 @@ static void raise_mce(struct mce *m)
 }
 
 /* Error injection interface */
-static ssize_t mce_write(struct file *filp, const char __user *ubuf,
+static ssize_t mce_write_inject(struct file *filp, const char __user *ubuf,
 			 size_t usize, loff_t *off)
 {
 	struct mce m;
@@ -210,17 +210,25 @@ static ssize_t mce_write(struct file *filp, const char __user *ubuf,
 	return usize;
 }
 
-static int inject_init(void)
+static int __init inject_init(void)
 {
 	if (!alloc_cpumask_var(&mce_inject_cpumask, GFP_KERNEL))
 		return -ENOMEM;
 	printk(KERN_INFO "Machine check injector initialized\n");
-	mce_chrdev_ops.write = mce_write;
+	mce_write_register(mce_write_inject);
 	register_die_notifier(&mce_raise_nb);
 	return 0;
 }
 
+static void __exit inject_exit(void)
+{
+	mce_write_unregister();
+	unregister_die_notifier(&mce_raise_nb);
+	free_cpumask_var(mce_inject_cpumask);
+}
+
 module_init(inject_init);
+module_exit(inject_exit);
 /*
  * Cannot tolerate unloading currently because we cannot
  * guarantee all openers of mce_chrdev will get a reference to us.
-- 
1.7.2

--
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