[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YWVKAk4h5bsUA3b6@light.dominikbrodowski.net>
Date: Tue, 12 Oct 2021 10:40:34 +0200
From: Dominik Brodowski <linux@...inikbrodowski.net>
To: "Ivan T. Ivanov" <iivanov@...e.de>
Cc: Ard Biesheuvel <ardb@...nel.org>,
Bhupesh Sharma <bhsharma@...hat.com>,
linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Revert "efi/random: Treat EFI_RNG_PROTOCOL output as
bootloader randomness"
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@...e.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
>
Powered by blists - more mailing lists