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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.58.0804171139170.12839@gandalf.stny.rr.com>
Date:	Thu, 17 Apr 2008 11:41:23 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	LKML <linux-kernel@...r.kernel.org>
cc:	Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...e.hu>,
	akpm@...dmis.org
Subject: [PATCH] lockdep: comment hidden releases of graph_lock 


While reviewing the lockdep.c code, it looked to me that I found a bug where
the release of the graph_lock was not done on failure. This turns out not
to be the case, because the graph_unlock is performed within the internal
functions of lockdep when a failure occurs.

To help out others when visually reviewing this code, I've added comments
to the places where it looks like it may be a bug not to call graph_unlock.

Signed-off-by: Steven Rostedt <srostedt@...hat.com>
---
 kernel/lockdep.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-sched-devel.git/kernel/lockdep.c
===================================================================
--- linux-sched-devel.git.orig/kernel/lockdep.c	2008-04-17 10:52:40.000000000 -0400
+++ linux-sched-devel.git/kernel/lockdep.c	2008-04-17 11:20:49.000000000 -0400
@@ -1566,6 +1566,7 @@ static int validate_chain(struct task_st
 		/*
 		 * Add dependency only if this lock is not the head
 		 * of the chain, and if it's not a secondary read-lock:
+		 * (will do graph_unlock on failure)
 		 */
 		if (!chain_head && ret != 2)
 			if (!check_prevs_add(curr, hlock))
@@ -2284,6 +2285,7 @@ static int mark_lock(struct task_struct

 	this->class->usage_mask |= new_mask;

+	/* save_trace does graph_unlock on failure */
 	if (!save_trace(this->class->usage_traces + new_bit))
 		return 0;

@@ -2296,6 +2298,7 @@ static int mark_lock(struct task_struct
 	case LOCK_ENABLED_SOFTIRQS:
 	case LOCK_ENABLED_HARDIRQS_READ:
 	case LOCK_ENABLED_SOFTIRQS_READ:
+		/* mark_lock_irq does graph_unlock on failure */
 		ret = mark_lock_irq(curr, this, new_bit);
 		if (!ret)
 			return 0;

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