diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 00:42:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 00:42:23 -0400 |
commit | dd5001e21a991b731d659857cd07acc7a13e6789 (patch) | |
tree | 42dd4fa7386242e4d728307519dbc6d9435c3575 /init | |
parent | a9fbcd6728837268784439ad0b02ede2c024c516 (diff) | |
parent | b7d5dc21072cda7124d13eae2aefb7343ef94197 (diff) |
Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random
Pull randomness updates from Ted Ts'o:
- initialize the random driver earler
- fix CRNG initialization when we trust the CPU's RNG on NUMA systems
- other miscellaneous cleanups and fixes.
* tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
random: add a spinlock_t to struct batched_entropy
random: document get_random_int() family
random: fix CRNG initialization when random.trust_cpu=1
random: move rand_initialize() earlier
random: only read from /dev/random after its pool has received 128 bits
drivers/char/random.c: make primary_crng static
drivers/char/random.c: remove unused stuct poolinfo::poolbits
drivers/char/random.c: constify poolinfo_table
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/init/main.c b/init/main.c index efe6d62e3846..33c87e91dc37 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -569,13 +569,6 @@ asmlinkage __visible void __init start_kernel(void) | |||
569 | page_address_init(); | 569 | page_address_init(); |
570 | pr_notice("%s", linux_banner); | 570 | pr_notice("%s", linux_banner); |
571 | setup_arch(&command_line); | 571 | setup_arch(&command_line); |
572 | /* | ||
573 | * Set up the the initial canary and entropy after arch | ||
574 | * and after adding latent and command line entropy. | ||
575 | */ | ||
576 | add_latent_entropy(); | ||
577 | add_device_randomness(command_line, strlen(command_line)); | ||
578 | boot_init_stack_canary(); | ||
579 | mm_init_cpumask(&init_mm); | 572 | mm_init_cpumask(&init_mm); |
580 | setup_command_line(command_line); | 573 | setup_command_line(command_line); |
581 | setup_nr_cpu_ids(); | 574 | setup_nr_cpu_ids(); |
@@ -660,6 +653,20 @@ asmlinkage __visible void __init start_kernel(void) | |||
660 | hrtimers_init(); | 653 | hrtimers_init(); |
661 | softirq_init(); | 654 | softirq_init(); |
662 | timekeeping_init(); | 655 | timekeeping_init(); |
656 | |||
657 | /* | ||
658 | * For best initial stack canary entropy, prepare it after: | ||
659 | * - setup_arch() for any UEFI RNG entropy and boot cmdline access | ||
660 | * - timekeeping_init() for ktime entropy used in rand_initialize() | ||
661 | * - rand_initialize() to get any arch-specific entropy like RDRAND | ||
662 | * - add_latent_entropy() to get any latent entropy | ||
663 | * - adding command line entropy | ||
664 | */ | ||
665 | rand_initialize(); | ||
666 | add_latent_entropy(); | ||
667 | add_device_randomness(command_line, strlen(command_line)); | ||
668 | boot_init_stack_canary(); | ||
669 | |||
663 | time_init(); | 670 | time_init(); |
664 | printk_safe_init(); | 671 | printk_safe_init(); |
665 | perf_event_init(); | 672 | perf_event_init(); |