linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: "Ivan T. Ivanov" <iivanov@suse.de>
Cc: Ard Biesheuvel <ardb@kernel.org>,
	Bhupesh Sharma <bhsharma@redhat.com>,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Revert "efi/random: Treat EFI_RNG_PROTOCOL output as bootloader randomness"
Date: Tue, 12 Oct 2021 10:40:34 +0200	[thread overview]
Message-ID: <YWVKAk4h5bsUA3b6@light.dominikbrodowski.net> (raw)
In-Reply-To: <20211012082708.121931-1-iivanov@suse.de>

Am Tue, Oct 12, 2021 at 11:27:08AM +0300 schrieb Ivan T. Ivanov:
> This reverts commit 18b915ac6b0ac5ba7ded03156860f60a9f16df2b.
> 
> When CONFIG_RANDOM_TRUST_BOOTLOADER is enabled add_bootloader_randomness()
> calls add_hwgenerator_randomness() which might sleep,

Wouldn't it be better to fix add_bootloader_randomness(), considering that
calls to that function are likely to happen quite early during kernel
initialization? Especially as it seems to have worked beforehand?

Thanks,
	Dominik

> but this is not
> possible during early kernel initialization. This revert fixes following
> NULL pointer deference:
> 
> [    0.000000] efi: seeding entropy pool
> [    0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> ...
> [    0.000000] pc : kthread_should_stop+0x2c/0x60
> [    0.000000] lr : add_hwgenerator_randomness+0x58/0x178
> ...
> [    0.000000] Call trace:
> [    0.000000]  kthread_should_stop+0x2c/0x60
> [    0.000000]  add_bootloader_randomness+0x2c/0x38
> [    0.000000]  efi_config_parse_tables+0x120/0x250
> [    0.000000]  efi_init+0x138/0x1e0
> [    0.000000]  setup_arch+0x394/0x778
> [    0.000000]  start_kernel+0x90/0x568
> 
> Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
> ---
>  drivers/firmware/efi/efi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 847f33ffc4ae..8aad3c524947 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -600,7 +600,7 @@ int __init efi_config_parse_tables(const efi_config_table_t *config_tables,
>  					      sizeof(*seed) + size);
>  			if (seed != NULL) {
>  				pr_notice("seeding entropy pool\n");
> -				add_bootloader_randomness(seed->bits, size);
> +				add_device_randomness(seed->bits, size);
>  				early_memunmap(seed, sizeof(*seed) + size);
>  			} else {
>  				pr_err("Could not map UEFI random seed!\n");
> -- 
> 2.33.0
> 

  reply	other threads:[~2021-10-12  8:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  8:27 [PATCH] Revert "efi/random: Treat EFI_RNG_PROTOCOL output as bootloader randomness" Ivan T. Ivanov
2021-10-12  8:40 ` Dominik Brodowski [this message]
2021-10-13  7:30   ` [RESEND] " Ivan T. Ivanov
2021-10-13  7:50     ` Ard Biesheuvel
2021-10-13  8:05       ` Ivan T. Ivanov
2021-10-13  9:51       ` [RESEND] " Ivan T. Ivanov
2021-10-13  9:53         ` Ivan T. Ivanov
2021-10-13 13:23           ` Ivan T. Ivanov
2021-10-31  6:30   ` [PATCH] random: fix crash on multiple early calls to add_bootloader_randomness() Dominik Brodowski
2021-10-31 12:33     ` Ard Biesheuvel
2021-11-03  7:14       ` Dominik Brodowski
2021-11-03  7:27         ` Ard Biesheuvel
2021-11-05  6:04           ` Dominik Brodowski
2021-11-03  7:17   ` [PATCH v2] " Dominik Brodowski
2021-11-05  6:04   ` [PATCH v3] " Dominik Brodowski
2021-11-24 12:32     ` Ivan T. Ivanov
2021-12-02 11:35   ` [PATCH v3, resend] " Dominik Brodowski
2021-12-02 16:55     ` Jason A. Donenfeld
2021-12-03  7:58       ` [PATCH v4] " Dominik Brodowski
2021-12-03 15:39         ` Jason A. Donenfeld
2021-12-03 16:47           ` Jason A. Donenfeld
2021-12-03 17:01             ` Dominik Brodowski
2021-12-06  8:14           ` Ivan T. Ivanov
2021-12-30 18:05             ` Jason A. Donenfeld
2022-01-04 15:06               ` Ivan T. Ivanov
2021-12-06  5:42         ` Hsin-Yi Wang
2021-12-06 20:57           ` [PATCH v5] " Dominik Brodowski
2021-12-07  7:09             ` Hsin-Yi Wang
2021-12-07  7:14               ` Dominik Brodowski
2021-12-07 17:22             ` Jason A. Donenfeld
2021-12-20 14:48               ` Jason A. Donenfeld

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=YWVKAk4h5bsUA3b6@light.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=ardb@kernel.org \
    --cc=bhsharma@redhat.com \
    --cc=iivanov@suse.de \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).