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]
Date:	Fri, 12 Feb 2016 00:22:58 +0100
From:	Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
To:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:	Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] kernel: sched: fix preempt_disable_ip recodring for
 preempt_disable()

Before:
 preempt_test(1) kernel_init_freeable+0x1bd/0x239
 preempt_test(2) preempt_test+0x75/0x15c
 preempt_test(3) preempt_test+0xaa/0x15c
 preempt_test(4) kernel_init_freeable+0x1bd/0x239
 preempt_test(5) kernel_init_freeable+0x1bd/0x239

After:
 preempt_test(1) preempt_test+0x2f/0x15c
 preempt_test(2) preempt_test+0x75/0x15c
 preempt_test(3) preempt_test+0xaa/0x15c
 preempt_test(4) preempt_test+0xd7/0x15c
 preempt_test(5) preempt_test+0x121/0x15c

diff --git a/init/main.c b/init/main.c
index 9e64d7097f1a..da4a4b10964a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -974,6 +974,35 @@ static int __ref kernel_init(void *unused)
 	      "See Linux Documentation/init.txt for guidance.");
 }
 
+static DEFINE_PER_CPU(unsigned long, pcpu_rtest_var);
+
+static noinline void preempt_test(void)
+{
+	spinlock_t sl;
+
+	spin_lock_init(&sl);
+
+	preempt_disable();
+	pr_err("%s(1) %pF\n", __func__, current->preempt_disable_ip);
+	preempt_enable();
+
+	spin_lock(&sl);
+	pr_err("%s(2) %pF\n", __func__, current->preempt_disable_ip);
+	spin_unlock(&sl);
+
+	spin_lock_bh(&sl);
+	pr_err("%s(3) %pF\n", __func__, current->preempt_disable_ip);
+	spin_unlock_bh(&sl);
+
+	get_cpu_var(pcpu_rtest_var);
+	pr_err("%s(4) %pF\n", __func__, current->preempt_disable_ip);
+	put_cpu_var(pcpu_rtest_var);
+
+	local_bh_disable();
+	pr_err("%s(5) %pF\n", __func__, current->preempt_disable_ip);
+	local_bh_enable();
+}
+
 static noinline void __init kernel_init_freeable(void)
 {
 	/*
@@ -1006,6 +1035,7 @@ static noinline void __init kernel_init_freeable(void)
 	page_alloc_init_late();
 
 	do_basic_setup();
+	preempt_test();
 
 	/* Open the /dev/console on the rootfs, this should never fail */
 	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ