From: Theodore Ts'o <tytso@mit.edu>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-next@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [BUG -next] "random: make /dev/urandom scalable for silly userspace programs" causes crash
Date: Wed, 27 Jul 2016 23:46:01 -0400 [thread overview]
Message-ID: <20160728034601.GC20032@thunk.org> (raw)
In-Reply-To: <20160727071400.GA3912@osiris>
On Wed, Jul 27, 2016 at 09:14:00AM +0200, Heiko Carstens wrote:
> it looks like your patch "random: make /dev/urandom scalable for silly
> userspace programs" within linux-next seems to be a bit broken:
>
> It causes this allocation failure and subsequent crash on s390 with fake
> NUMA enabled
Thanks for reporting this. This patch fixes things for you, yes?
- Ted
commit 59b8d4f1f5d26e4ca92172ff6dcd1492cdb39613
Author: Theodore Ts'o <tytso@mit.edu>
Date: Wed Jul 27 23:30:25 2016 -0400
random: use for_each_online_node() to iterate over NUMA nodes
This fixes a crash on s390 with fake NUMA enabled.
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly userspace programs")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 8d0af74..7f06224 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1668,13 +1668,12 @@ static int rand_initialize(void)
#ifdef CONFIG_NUMA
pool = kmalloc(num_nodes * sizeof(void *),
GFP_KERNEL|__GFP_NOFAIL|__GFP_ZERO);
- for (i=0; i < num_nodes; i++) {
+ for_each_online_node(i) {
crng = kmalloc_node(sizeof(struct crng_state),
GFP_KERNEL | __GFP_NOFAIL, i);
spin_lock_init(&crng->lock);
crng_initialize(crng);
pool[i] = crng;
-
}
mb();
crng_node_pool = pool;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "Theodore Ts'o" <tytso@mit.edu>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-next@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [BUG -next] "random: make /dev/urandom scalable for silly userspace programs" causes crash
Date: Wed, 27 Jul 2016 23:46:01 -0400 [thread overview]
Message-ID: <20160728034601.GC20032@thunk.org> (raw)
In-Reply-To: <20160727071400.GA3912@osiris>
On Wed, Jul 27, 2016 at 09:14:00AM +0200, Heiko Carstens wrote:
> it looks like your patch "random: make /dev/urandom scalable for silly
> userspace programs" within linux-next seems to be a bit broken:
>
> It causes this allocation failure and subsequent crash on s390 with fake
> NUMA enabled
Thanks for reporting this. This patch fixes things for you, yes?
- Ted
commit 59b8d4f1f5d26e4ca92172ff6dcd1492cdb39613
Author: Theodore Ts'o <tytso@mit.edu>
Date: Wed Jul 27 23:30:25 2016 -0400
random: use for_each_online_node() to iterate over NUMA nodes
This fixes a crash on s390 with fake NUMA enabled.
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly userspace programs")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 8d0af74..7f06224 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1668,13 +1668,12 @@ static int rand_initialize(void)
#ifdef CONFIG_NUMA
pool = kmalloc(num_nodes * sizeof(void *),
GFP_KERNEL|__GFP_NOFAIL|__GFP_ZERO);
- for (i=0; i < num_nodes; i++) {
+ for_each_online_node(i) {
crng = kmalloc_node(sizeof(struct crng_state),
GFP_KERNEL | __GFP_NOFAIL, i);
spin_lock_init(&crng->lock);
crng_initialize(crng);
pool[i] = crng;
-
}
mb();
crng_node_pool = pool;
next prev parent reply other threads:[~2016-07-28 3:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 7:14 [BUG -next] "random: make /dev/urandom scalable for silly userspace programs" causes crash Heiko Carstens
2016-07-27 7:14 ` Heiko Carstens
2016-07-28 3:46 ` Theodore Ts'o [this message]
2016-07-28 3:46 ` Theodore Ts'o
2016-07-28 5:55 ` Heiko Carstens
2016-07-28 5:55 ` Heiko Carstens
2016-07-28 7:24 ` Heiko Carstens
2016-07-28 7:24 ` Heiko Carstens
2016-07-28 13:41 ` Theodore Ts'o
2016-07-28 13:41 ` Theodore Ts'o
2016-07-28 23:56 ` Tony Luck
2016-07-28 23:56 ` Tony Luck
2016-07-28 18:12 ` Joe Perches
2016-07-28 18:12 ` Joe Perches
2016-07-28 18:12 ` Joe Perches
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=20160728034601.GC20032@thunk.org \
--to=tytso@mit.edu \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/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.