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] [day] [month] [year] [list]
Message-ID: <20080518151048.GB18000@cvg>
Date:	Sun, 18 May 2008 19:10:48 +0400
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	linux-kernel@...r.kernel.org,
	Michael Halcrow <mhalcrow@...ibm.com>,
	Eric Sandeen <sandeen@...hat.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [v2.6.26-rc1] possible circular locking in ecryptfs

[Ingo Molnar - Sun, May 18, 2008 at 01:40:20PM +0200]
| 
| * Cyrill Gorcunov <gorcunov@...il.com> wrote:
| 
| > [Ingo Molnar - Fri, May 09, 2008 at 11:44:23AM +0200]
| > | 
| > | * Ingo Molnar <mingo@...e.hu> wrote:
| > | 
| > | > x86.git testing found the following "possible circular locking" 
| > | > lockdep warning, generated by the ecryptfs code:
| > | 
| > | the correct URL for the config is:
| > | 
| > |   http://redhat.com/~mingo/misc/config-Wed_May__7_16_17_31_CEST_2008.bad
| > | 
| > | this is reproducible, it happened a second time since i originally 
| > | reported it.
| > | 
| > | 	Ingo
| > 
| > Hi Ingo, I've just sent patch, could you test it, please?
| > 
| > http://lkml.org/lkml/2008/5/10/20
| 
| that patch is now upstream - but see below there's still a circular 
| dependency.
| 
| 	Ingo
| 
| 

Ingo, could you test this patch please? If it help I will send
it in normal way.

		- Cyrill -
---

Index: linux-2.6.git/fs/ecryptfs/miscdev.c
===================================================================
--- linux-2.6.git.orig/fs/ecryptfs/miscdev.c	2008-05-18 18:53:56.000000000 +0400
+++ linux-2.6.git/fs/ecryptfs/miscdev.c	2008-05-18 19:08:25.000000000 +0400
@@ -50,7 +50,6 @@ ecryptfs_miscdev_poll(struct file *file,
 					  current->nsproxy->user_ns);
 	BUG_ON(rc || !daemon);
 	mutex_lock(&daemon->mux);
-	mutex_unlock(&ecryptfs_daemon_hash_mux);
 	if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
 		printk(KERN_WARNING "%s: Attempt to poll on zombified "
 		       "daemon\n", __func__);
@@ -62,6 +61,7 @@ ecryptfs_miscdev_poll(struct file *file,
 		goto out_unlock_daemon;
 	daemon->flags |= ECRYPTFS_DAEMON_IN_POLL;
 	mutex_unlock(&daemon->mux);
+	mutex_unlock(&ecryptfs_daemon_hash_mux);
 	poll_wait(file, &daemon->wait, pt);
 	mutex_lock(&daemon->mux);
 	if (!list_empty(&daemon->msg_ctx_out_queue))
@@ -69,6 +69,8 @@ ecryptfs_miscdev_poll(struct file *file,
 out_unlock_daemon:
 	daemon->flags &= ~ECRYPTFS_DAEMON_IN_POLL;
 	mutex_unlock(&daemon->mux);
+	if (mutex_is_locked(&ecryptfs_daemon_hash_mux))
+		mutex_unlock(&ecryptfs_daemon_hash_mux);
 	return mask;
 }
 
@@ -257,14 +259,12 @@ ecryptfs_miscdev_read(struct file *file,
 	mutex_lock(&daemon->mux);
 	if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
 		rc = 0;
-		mutex_unlock(&ecryptfs_daemon_hash_mux);
 		printk(KERN_WARNING "%s: Attempt to read from zombified "
 		       "daemon\n", __func__);
 		goto out_unlock_daemon;
 	}
 	if (daemon->flags & ECRYPTFS_DAEMON_IN_READ) {
 		rc = 0;
-		mutex_unlock(&ecryptfs_daemon_hash_mux);
 		goto out_unlock_daemon;
 	}
 	/* This daemon will not go away so long as this flag is set */
@@ -357,6 +357,8 @@ out_unlock_msg_ctx:
 out_unlock_daemon:
 	daemon->flags &= ~ECRYPTFS_DAEMON_IN_READ;
 	mutex_unlock(&daemon->mux);
+	if (mutex_is_locked(&ecryptfs_daemon_hash_mux))
+		mutex_unlock(&ecryptfs_daemon_hash_mux);
 	return rc;
 }
 
--
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