]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
random pending patch is now queued up.
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Apr 2018 10:36:20 +0000 (12:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Apr 2018 10:36:20 +0000 (12:36 +0200)
pending/queue-4.14/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch [deleted file]
pending/queue-4.16/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch [deleted file]
pending/queue-4.9/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch [deleted file]

diff --git a/pending/queue-4.14/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch b/pending/queue-4.14/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch
deleted file mode 100644 (file)
index b999809..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-From 8ef35c866f8862df074a49a93b0309725812dea8 Mon Sep 17 00:00:00 2001
-From: Theodore Ts'o <tytso@mit.edu>
-Date: Wed, 11 Apr 2018 15:23:56 -0400
-Subject: random: set up the NUMA crng instances after the CRNG is fully initialized
-
-From: Theodore Ts'o <tytso@mit.edu>
-
-commit 8ef35c866f8862df074a49a93b0309725812dea8 upstream.
-
-Until the primary_crng is fully initialized, don't initialize the NUMA
-crng nodes.  Otherwise users of /dev/urandom on NUMA systems before
-the CRNG is fully initialized can get very bad quality randomness.  Of
-course everyone should move to getrandom(2) where this won't be an
-issue, but there's a lot of legacy code out there.  This related to
-CVE-2018-1108.
-
-Reported-by: Jann Horn <jannh@google.com>
-Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly...")
-Cc: stable@kernel.org # 4.8+
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- drivers/char/random.c |   46 +++++++++++++++++++++++++++-------------------
- 1 file changed, 27 insertions(+), 19 deletions(-)
-
---- a/drivers/char/random.c
-+++ b/drivers/char/random.c
-@@ -786,6 +786,32 @@ static void crng_initialize(struct crng_
-       crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
- }
-+#ifdef CONFIG_NUMA
-+static void numa_crng_init(void)
-+{
-+      int i;
-+      struct crng_state *crng;
-+      struct crng_state **pool;
-+
-+      pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL|__GFP_NOFAIL);
-+      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();
-+      if (cmpxchg(&crng_node_pool, NULL, pool)) {
-+              for_each_node(i)
-+                      kfree(pool[i]);
-+              kfree(pool);
-+      }
-+}
-+#else
-+static void numa_crng_init(void) {}
-+#endif
-+
- /*
-  * crng_fast_load() can be called by code in the interrupt service
-  * path.  So we can't afford to dilly-dally.
-@@ -892,6 +918,7 @@ static void crng_reseed(struct crng_stat
-       spin_unlock_irqrestore(&primary_crng.lock, flags);
-       if (crng == &primary_crng && crng_init < 2) {
-               invalidate_batched_entropy();
-+              numa_crng_init();
-               crng_init = 2;
-               process_random_ready_list();
-               wake_up_interruptible(&crng_init_wait);
-@@ -1729,28 +1756,9 @@ static void init_std_data(struct entropy
-  */
- static int rand_initialize(void)
- {
--#ifdef CONFIG_NUMA
--      int i;
--      struct crng_state *crng;
--      struct crng_state **pool;
--#endif
--
-       init_std_data(&input_pool);
-       init_std_data(&blocking_pool);
-       crng_initialize(&primary_crng);
--
--#ifdef CONFIG_NUMA
--      pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL|__GFP_NOFAIL);
--      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;
--#endif
-       return 0;
- }
- early_initcall(rand_initialize);
diff --git a/pending/queue-4.16/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch b/pending/queue-4.16/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch
deleted file mode 100644 (file)
index b999809..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-From 8ef35c866f8862df074a49a93b0309725812dea8 Mon Sep 17 00:00:00 2001
-From: Theodore Ts'o <tytso@mit.edu>
-Date: Wed, 11 Apr 2018 15:23:56 -0400
-Subject: random: set up the NUMA crng instances after the CRNG is fully initialized
-
-From: Theodore Ts'o <tytso@mit.edu>
-
-commit 8ef35c866f8862df074a49a93b0309725812dea8 upstream.
-
-Until the primary_crng is fully initialized, don't initialize the NUMA
-crng nodes.  Otherwise users of /dev/urandom on NUMA systems before
-the CRNG is fully initialized can get very bad quality randomness.  Of
-course everyone should move to getrandom(2) where this won't be an
-issue, but there's a lot of legacy code out there.  This related to
-CVE-2018-1108.
-
-Reported-by: Jann Horn <jannh@google.com>
-Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly...")
-Cc: stable@kernel.org # 4.8+
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- drivers/char/random.c |   46 +++++++++++++++++++++++++++-------------------
- 1 file changed, 27 insertions(+), 19 deletions(-)
-
---- a/drivers/char/random.c
-+++ b/drivers/char/random.c
-@@ -786,6 +786,32 @@ static void crng_initialize(struct crng_
-       crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
- }
-+#ifdef CONFIG_NUMA
-+static void numa_crng_init(void)
-+{
-+      int i;
-+      struct crng_state *crng;
-+      struct crng_state **pool;
-+
-+      pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL|__GFP_NOFAIL);
-+      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();
-+      if (cmpxchg(&crng_node_pool, NULL, pool)) {
-+              for_each_node(i)
-+                      kfree(pool[i]);
-+              kfree(pool);
-+      }
-+}
-+#else
-+static void numa_crng_init(void) {}
-+#endif
-+
- /*
-  * crng_fast_load() can be called by code in the interrupt service
-  * path.  So we can't afford to dilly-dally.
-@@ -892,6 +918,7 @@ static void crng_reseed(struct crng_stat
-       spin_unlock_irqrestore(&primary_crng.lock, flags);
-       if (crng == &primary_crng && crng_init < 2) {
-               invalidate_batched_entropy();
-+              numa_crng_init();
-               crng_init = 2;
-               process_random_ready_list();
-               wake_up_interruptible(&crng_init_wait);
-@@ -1729,28 +1756,9 @@ static void init_std_data(struct entropy
-  */
- static int rand_initialize(void)
- {
--#ifdef CONFIG_NUMA
--      int i;
--      struct crng_state *crng;
--      struct crng_state **pool;
--#endif
--
-       init_std_data(&input_pool);
-       init_std_data(&blocking_pool);
-       crng_initialize(&primary_crng);
--
--#ifdef CONFIG_NUMA
--      pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL|__GFP_NOFAIL);
--      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;
--#endif
-       return 0;
- }
- early_initcall(rand_initialize);
diff --git a/pending/queue-4.9/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch b/pending/queue-4.9/random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch
deleted file mode 100644 (file)
index 2cb2d45..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-From 8ef35c866f8862df074a49a93b0309725812dea8 Mon Sep 17 00:00:00 2001
-From: Theodore Ts'o <tytso@mit.edu>
-Date: Wed, 11 Apr 2018 15:23:56 -0400
-Subject: random: set up the NUMA crng instances after the CRNG is fully initialized
-
-From: Theodore Ts'o <tytso@mit.edu>
-
-commit 8ef35c866f8862df074a49a93b0309725812dea8 upstream.
-
-Until the primary_crng is fully initialized, don't initialize the NUMA
-crng nodes.  Otherwise users of /dev/urandom on NUMA systems before
-the CRNG is fully initialized can get very bad quality randomness.  Of
-course everyone should move to getrandom(2) where this won't be an
-issue, but there's a lot of legacy code out there.  This related to
-CVE-2018-1108.
-
-Reported-by: Jann Horn <jannh@google.com>
-Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly...")
-Cc: stable@kernel.org # 4.8+
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- drivers/char/random.c |   46 +++++++++++++++++++++++++++-------------------
- 1 file changed, 27 insertions(+), 19 deletions(-)
-
---- a/drivers/char/random.c
-+++ b/drivers/char/random.c
-@@ -818,6 +818,32 @@ static int crng_fast_load(const char *cp
-       return 1;
- }
-+#ifdef CONFIG_NUMA
-+static void numa_crng_init(void)
-+{
-+      int i;
-+      struct crng_state *crng;
-+      struct crng_state **pool;
-+
-+      pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL|__GFP_NOFAIL);
-+      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();
-+      if (cmpxchg(&crng_node_pool, NULL, pool)) {
-+              for_each_node(i)
-+                      kfree(pool[i]);
-+              kfree(pool);
-+      }
-+}
-+#else
-+static void numa_crng_init(void) {}
-+#endif
-+
- static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
- {
-       unsigned long   flags;
-@@ -847,6 +873,7 @@ static void crng_reseed(struct crng_stat
-       memzero_explicit(&buf, sizeof(buf));
-       crng->init_time = jiffies;
-       if (crng == &primary_crng && crng_init < 2) {
-+              numa_crng_init();
-               crng_init = 2;
-               process_random_ready_list();
-               wake_up_interruptible(&crng_init_wait);
-@@ -1659,28 +1686,9 @@ static void init_std_data(struct entropy
-  */
- static int rand_initialize(void)
- {
--#ifdef CONFIG_NUMA
--      int i;
--      struct crng_state *crng;
--      struct crng_state **pool;
--#endif
--
-       init_std_data(&input_pool);
-       init_std_data(&blocking_pool);
-       crng_initialize(&primary_crng);
--
--#ifdef CONFIG_NUMA
--      pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL|__GFP_NOFAIL);
--      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;
--#endif
-       return 0;
- }
- early_initcall(rand_initialize);