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>] [day] [month] [year] [list]
Message-Id: <1446284067-21062-1-git-send-email-sudipm.mukherjee@gmail.com>
Date:	Sat, 31 Oct 2015 15:04:27 +0530
From:	Sudip Mukherjee <sudipm.mukherjee@...il.com>
To:	Vegard Nossum <vegardno@....uio.no>,
	Pekka Enberg <penberg@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>
Cc:	linux-kernel@...r.kernel.org, x86@...nel.org,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH] arch/x86/mm/kmemcheck/kmemcheck.c: use max cpus

If SMP is enabled then to use kmemcheck we are limiting to one CPU. And
if kmemcheck selftest fails, we are disabling kmemcheck and returning. But
we are still using single CPU even though kmemcheck is disabled.
Use the original max cpu value if kmemcheck selftest fails.

Signed-off-by: Sudip Mukherjee <sudip@...torindia.org>
---
 arch/x86/mm/kmemcheck/kmemcheck.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index b4f2e7e..4f09508 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -52,8 +52,12 @@ int __init kmemcheck_init(void)
 #ifdef CONFIG_SMP
 	/*
 	 * Limit SMP to use a single CPU. We rely on the fact that this code
-	 * runs before SMP is set up.
+	 * runs before SMP is set up. Save the original value so that if
+	 * kmemcheck_selftest() fails we can use the original value
+	 * instead of using single CPU.
 	 */
+	unsigned int orig_max_cpu = setup_max_cpus;
+
 	if (setup_max_cpus > 1) {
 		printk(KERN_INFO
 			"kmemcheck: Limiting number of CPUs to 1.\n");
@@ -64,6 +68,9 @@ int __init kmemcheck_init(void)
 	if (!kmemcheck_selftest()) {
 		printk(KERN_INFO "kmemcheck: self-tests failed; disabling\n");
 		kmemcheck_enabled = 0;
+#ifdef CONFIG_SMP
+		setup_max_cpus = orig_max_cpu;
+#endif
 		return -EINVAL;
 	}
 
-- 
1.9.1

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