From: Sasha Levin <levinsasha928@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Dave Jones <davej@redhat.com>, davem <davem@davemloft.net>,
Pekka Enberg <penberg@kernel.org>,
Christoph Lameter <cl@linux-foundation.org>,
Matt Mackall <mpm@selenic.com>,
kaber@trash.net, pablo@netfilter.org,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
netfilter-devel@vger.kernel.org, netdev <netdev@vger.kernel.org>
Subject: Re: Hung task when calling clone() due to netfilter/slab
Date: Sun, 15 Jan 2012 14:59:44 +0200 [thread overview]
Message-ID: <1326632384.11711.3.camel@lappy> (raw)
In-Reply-To: <1326561043.5287.24.camel@edumazet-laptop>
On Sat, 2012-01-14 at 18:10 +0100, Eric Dumazet wrote:
> Apparently SLUB calls sysfs_slab_add() from kmem_cache_create() while
> still holding slub_lock.
>
> So if the task launched needs to "cat /proc/slabinfo" or anything
> needing slub_lock, its a deadlock.
I've made the following patch to test it, It doesn't look like it's the correct solution, but it verifies that the problem is there (it works well with the patch).
---------------
>From cc4874b491b8e5d9d1ea5bf2032413efdbddced8 Mon Sep 17 00:00:00 2001
From: Sasha Levin <levinsasha928@gmail.com>
Date: Sun, 15 Jan 2012 14:55:03 +0200
Subject: [PATCH] slab: Fix hang when creating sysfs entries
This patch fixes the hang which happens when we create a sysfs entry and call
back to userspace. If the usermode helper tries to do anything which involves
slub_lock we will hang since slub_lock is already held.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
mm/slub.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 4907563..6948327 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5283,7 +5283,9 @@ static int sysfs_slab_add(struct kmem_cache *s)
kobject_put(&s->kobj);
return err;
}
+ up_write(&slub_lock);
kobject_uevent(&s->kobj, KOBJ_ADD);
+ down_write(&slub_lock);
if (!unmergeable) {
/* Setup first alias */
sysfs_slab_alias(s, s->name);
--
1.7.8.3
--
Sasha.
WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <levinsasha928@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Dave Jones <davej@redhat.com>, davem <davem@davemloft.net>,
Pekka Enberg <penberg@kernel.org>,
Christoph Lameter <cl@linux-foundation.org>,
Matt Mackall <mpm@selenic.com>,
kaber@trash.net, pablo@netfilter.org,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
netfilter-devel@vger.kernel.org, netdev <netdev@vger.kernel.org>
Subject: Re: Hung task when calling clone() due to netfilter/slab
Date: Sun, 15 Jan 2012 14:59:44 +0200 [thread overview]
Message-ID: <1326632384.11711.3.camel@lappy> (raw)
In-Reply-To: <1326561043.5287.24.camel@edumazet-laptop>
On Sat, 2012-01-14 at 18:10 +0100, Eric Dumazet wrote:
> Apparently SLUB calls sysfs_slab_add() from kmem_cache_create() while
> still holding slub_lock.
>
> So if the task launched needs to "cat /proc/slabinfo" or anything
> needing slub_lock, its a deadlock.
I've made the following patch to test it, It doesn't look like it's the correct solution, but it verifies that the problem is there (it works well with the patch).
---------------
next prev parent reply other threads:[~2012-01-15 12:59 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-14 16:30 Hung task when calling clone() due to netfilter/slab Sasha Levin
2012-01-14 16:30 ` Sasha Levin
2012-01-14 17:10 ` Eric Dumazet
2012-01-14 17:10 ` Eric Dumazet
2012-01-14 17:10 ` Eric Dumazet
2012-01-14 17:18 ` Eric Dumazet
2012-01-14 17:18 ` Eric Dumazet
2012-01-14 17:18 ` Eric Dumazet
2012-01-15 12:59 ` Sasha Levin [this message]
2012-01-15 12:59 ` Sasha Levin
2012-01-15 17:25 ` Eric Dumazet
2012-01-15 17:25 ` Eric Dumazet
2012-01-15 17:25 ` Eric Dumazet
2012-01-17 15:12 ` Christoph Lameter
2012-01-17 15:12 ` Christoph Lameter
2012-01-17 15:20 ` Eric Dumazet
2012-01-17 15:20 ` Eric Dumazet
2012-01-17 15:20 ` Eric Dumazet
2012-01-17 15:27 ` Christoph Lameter
2012-01-17 15:27 ` Christoph Lameter
2012-01-17 15:30 ` Eric Dumazet
2012-01-17 15:30 ` Eric Dumazet
2012-01-17 15:30 ` Eric Dumazet
2012-01-17 16:04 ` Christoph Lameter
2012-01-17 16:04 ` Christoph Lameter
2012-01-17 22:22 ` Christoph Lameter
2012-01-17 22:22 ` Christoph Lameter
2012-01-19 21:43 ` Eric W. Biederman
2012-01-19 21:43 ` Eric W. Biederman
2012-01-19 22:15 ` Eric W. Biederman
2012-01-19 22:15 ` Eric W. Biederman
2012-01-20 2:03 ` Christoph Lameter
2012-01-20 2:03 ` Christoph Lameter
2012-01-20 2:31 ` Eric W. Biederman
2012-01-20 2:31 ` Eric W. Biederman
2012-01-20 14:49 ` Christoph Lameter
2012-01-20 14:49 ` Christoph Lameter
2012-01-20 20:40 ` Eric W. Biederman
2012-01-20 20:40 ` Eric W. Biederman
2012-02-01 8:05 ` Pekka Enberg
2012-02-01 8:05 ` Pekka Enberg
2012-02-01 17:32 ` Eric W. Biederman
2012-02-01 17:32 ` Eric W. Biederman
2012-02-01 8:07 ` Pekka Enberg
2012-02-01 8:07 ` Pekka Enberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326632384.11711.3.camel@lappy \
--to=levinsasha928@gmail.com \
--cc=cl@linux-foundation.org \
--cc=davej@redhat.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mpm@selenic.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=penberg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.