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: <tip-7a10e2a9190628a4024ea394ce7bd641ae40ffd1@git.kernel.org>
Date:   Wed, 8 Nov 2017 02:54:34 -0800
From:   tip-bot for Frederic Weisbecker <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     tj@...nel.org, torvalds@...ux-foundation.org, peterz@...radead.org,
        tglx@...utronix.de, jiangshanlai@...il.com, frederic@...nel.org,
        hpa@...or.com, linux-kernel@...r.kernel.org,
        paulmck@...ux.vnet.ibm.com, davem@...emloft.net, mingo@...nel.org
Subject: [tip:locking/core] x86: Use lockdep to assert IRQs are
 disabled/enabled

Commit-ID:  7a10e2a9190628a4024ea394ce7bd641ae40ffd1
Gitweb:     https://git.kernel.org/tip/7a10e2a9190628a4024ea394ce7bd641ae40ffd1
Author:     Frederic Weisbecker <frederic@...nel.org>
AuthorDate: Mon, 6 Nov 2017 16:01:23 +0100
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Wed, 8 Nov 2017 11:13:50 +0100

x86: Use lockdep to assert IRQs are disabled/enabled

Use lockdep to check that IRQs are enabled or disabled as expected. This
way the sanity check only shows overhead when concurrency correctness
debug code is enabled.

It also makes no more sense to fix the IRQ flags when a bug is detected
as the assertion is now pure config-dependent debugging. And to quote
Peter Zijlstra:

	The whole if !disabled, disable logic is uber paranoid programming,
	but I don't think we've ever seen that WARN trigger, and if it does
	(and then burns the kernel) we at least know what happend.

Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
Acked-by: Thomas Gleixner <tglx@...utronix.de>
Cc: David S . Miller <davem@...emloft.net>
Cc: Lai Jiangshan <jiangshanlai@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Tejun Heo <tj@...nel.org>
Link: http://lkml.kernel.org/r/1509980490-4285-8-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 arch/x86/entry/common.c   | 4 +---
 arch/x86/kernel/smpboot.c | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index eaa0ba6..d7d3cc2 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -186,9 +186,7 @@ __visible inline void prepare_exit_to_usermode(struct pt_regs *regs)
 
 	addr_limit_user_check();
 
-	if (IS_ENABLED(CONFIG_PROVE_LOCKING) && WARN_ON(!irqs_disabled()))
-		local_irq_disable();
-
+	lockdep_assert_irqs_disabled();
 	lockdep_sys_exit();
 
 	cached_flags = READ_ONCE(ti->flags);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 198416d..4008b6b 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1095,7 +1095,7 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
 	unsigned long flags;
 	int err, ret = 0;
 
-	WARN_ON(irqs_disabled());
+	lockdep_assert_irqs_enabled();
 
 	pr_debug("++++++++++++++++++++=_---CPU UP  %u\n", cpu);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ