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-next>] [day] [month] [year] [list]
Date:   Sat, 23 Dec 2017 02:15:19 +0530
From:   gaurav jindal <gauravjindal1104@...il.com>
To:     peterz@...radead.org, mingo@...hat.com
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH]locking:mutex Print warning if trylock in irq context

Since mutex_trylock must not be called from interrupt context, a robustness
can be added to this function by throwing a warning if it is called in
interrupt context.
It would help to make debugging easier in case of undesired calling of this
function.

Signed-off-by: gaurav jindal<gauravjindal1104@...il.com>

---

diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 858a075..fe1cace 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -1176,7 +1176,10 @@ void __sched mutex_lock_io(struct mutex *lock)
  */
 int __sched mutex_trylock(struct mutex *lock)
 {
-	bool locked = __mutex_trylock(lock);
+	bool locked;
+
+	WARN_ONCE(in_irq(), "%s wrongly called in irq context", __func__);
+	locked = __mutex_trylock(lock);

 	if (locked)
 		mutex_acquire(&lock->dep_map, 0, 1, _RET_IP_);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ