* FW: [PATCH] AB-BA deadlock between uidhash_lock and tasklist_lock.
@ 2004-12-22 23:12 Robin Holt
0 siblings, 0 replies; only message in thread
From: Robin Holt @ 2004-12-22 23:12 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
We have uncovered a very difficult to trip AB-BA deadlock between the
uidhash_lock and tasklist_lock.
reparent_to_init() does write_lock_irq(&tasklist_lock) then calls
switch_uid() which calls free_uid() which grabs the uidhash_lock.
Independent of that, we have seen a different cpu call free_uid as a
result of sys_wait4 and, immediately after acquiring the uidhash_lock,
receive a timer interrupt which eventually leads to an attempt to grab
the tasklist_lock.
Signed-off-by: Robin Holt <holt@sgi.com>
Index: linux/kernel/user.c
===================================================================
--- linux.orig/kernel/user.c 2004-12-22 13:10:49.000000000 -0600
+++ linux/kernel/user.c 2004-12-22 16:04:40.244569776 -0600
@@ -90,6 +90,9 @@
void free_uid(struct user_struct *up)
{
+ unsigned long flags;
+
+ local_irq_save(flags);
if (up && atomic_dec_and_lock(&up->__count, &uidhash_lock)) {
uid_hash_remove(up);
key_put(up->uid_keyring);
@@ -97,6 +100,7 @@
kmem_cache_free(uid_cachep, up);
spin_unlock(&uidhash_lock);
}
+ local_irq_restore(flags);
}
struct user_struct * alloc_uid(uid_t uid)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-12-22 23:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-22 23:12 FW: [PATCH] AB-BA deadlock between uidhash_lock and tasklist_lock Robin Holt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®