From: "Ivan T. Ivanov" <iivanov@suse.de>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
linux-efi <linux-efi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND] Re: [PATCH] Revert "efi/random: Treat EFI_RNG_PROTOCOL output as bootloader randomness"
Date: Wed, 13 Oct 2021 11:05:39 +0300 [thread overview]
Message-ID: <e8c2ce11ec8b6193d891288ce6b3caa0@suse.de> (raw)
In-Reply-To: <CAMj1kXE7FbEqxyBcPS6mx5wU82+H0WK67HU=S6hq=WAG5EBwyQ@mail.gmail.com>
On 2021-10-13 10:50, Ard Biesheuvel wrote:
> On Wed, 13 Oct 2021 at 09:30, Ivan T. Ivanov <iivanov@suse.de> wrote:
>>
>> Hi,
>>
>> Quoting Dominik Brodowski (2021-10-12 11:40:34)
>> > 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?
>>
>> I have tried. I made wait_event_interruptible() optional, but then
>> crng_reseed() segfault badly. And I don't think crng_reseed() is
>> something that I could fix easily. Suggestions are welcomed ;-)
>>
>
> How about
>
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index 605969ed0f96..1828dc691ebf 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -2297,9 +2297,8 @@ EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
> */
> void add_bootloader_randomness(const void *buf, unsigned int size)
> {
> + add_device_randomness(buf, size);
> if (IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER))
> - add_hwgenerator_randomness(buf, size, size * 8);
> - else
> - add_device_randomness(buf, size);
> + credit_entropy(&input_pool, size * 8);
> }
> EXPORT_SYMBOL_GPL(add_bootloader_randomness);
This is more or less what I have done. credit_entropy() calls
crng_reseed() which crash badly.
Will check again, but I am sure it will give me same result.
Regards,
Ivan
next prev parent reply other threads:[~2021-10-13 8:05 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
2021-10-13 7:30 ` [RESEND] " Ivan T. Ivanov
2021-10-13 7:50 ` Ard Biesheuvel
2021-10-13 8:05 ` Ivan T. Ivanov [this message]
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=e8c2ce11ec8b6193d891288ce6b3caa0@suse.de \
--to=iivanov@suse.de \
--cc=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
/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).