Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3207242pxb; Wed, 13 Oct 2021 00:55:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQXdicIfI8P0JaVTgyyBnmEbcIAM2oshSAawGEhIuV2+vQfN66COkbDGNiZZvMn8OAwKar X-Received: by 2002:a50:d8cf:: with SMTP id y15mr7403074edj.66.1634111724031; Wed, 13 Oct 2021 00:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634111724; cv=none; d=google.com; s=arc-20160816; b=Z8bSrm9OwhvjWAiEEH1PzPpVd027wD4jskMYSSPo0UZl9NgvQCQXTQU+kaEJi6DDyj M4QIKQNux5XdhbBWLNuno1DZjHZq+Ry42IgMkiPXoylsv6imD9n+wkPX/Dc5hekg0E4e V3Ak4wum81b6j/pFsqvCp4r/9ZJ+K09A7kcA81ilpHCTUuyafH3wRWi0M9wIvZUprrzF Nn3/s+eiD1L3MAkKBpPEJTNExX57T1mDFBDd3aKCGtJSfHCAiBjcjD/gluM+cgI4MkEe C6ESR03I1QJmVvfR2tI2Oqni/tSIDe+Ja8fk1FjBXpYAfaaz6nyoue5MdhfupVIIJEU9 8Zug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=u4vnmGXSoB4EoW3VQf4Z4bs2zN1SYs6aGcUXz012f10=; b=o4g6FHCzjISuFeouYeu1woYBO1fZjwZ/KMLmtC0OR+W7slgLN7Rwb5xHGzivrkV1uR A34vKauRhWOUlo848H7o8nTBpdWN5qGvXU3uutHgqJkX4FTOSNxrUOLk/jlu8rWChsj8 T7nBf45YqJInJZtcjfvIAWhCd0Ma/tymSHGSR/fvzk5T1/6Q5PLMvsH3Q4KamFw66O67 DYXZdRaNvIzBQQOcTBaBd9qN2DITtsET4knHvWSNey9O6sFa2rZ1me9zzG95FwpkjRof r5kCNizzb2oOUL1nDkEuo7+Yt9z/ALd6NZBOx8+ZjnrBxU0gOLISulLsP6X5qU7R8oXM tiKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nMCMOuPr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 2si9693432ejw.30.2021.10.13.00.55.00; Wed, 13 Oct 2021 00:55:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nMCMOuPr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238692AbhJMHxE (ORCPT + 99 others); Wed, 13 Oct 2021 03:53:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238626AbhJMHxD (ORCPT ); Wed, 13 Oct 2021 03:53:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AA3DB60F94; Wed, 13 Oct 2021 07:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634111460; bh=OXCqkhh4wPeAYcArRqvAfGp3MlPsBVIOg7joR3nwwmI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nMCMOuPrDQuPbS+XQ0PC5jK7hV5MAY1+SYszB0z0L3g4lSapQXCtooKSLHzqfRbCA uCMvyNLQN4q7rMULxd4s3/QgvyRETNssjKsgsMTIRhKymonkWkAGid8HXpq+W/lCzW XWVARwXuGZzXsEmNhax2j7RD2SDGY/1qx3GNAIureFtSSoBEdoIdu9RoOVtSZQI9mN JDcheFuwrGoQnxURMtjMLSAj0yTqaTFp3EL67ZzHG8PKLYPVbJeWAUVj0JRnVz2gyZ vatgiMENXuuU+tr7jUcx+xEE/M8l+SvbFMKTXDo8+jGEek7+lx8Q4sdX434vEbPFMl a6YTvLwpBwyLw== Received: by mail-ot1-f51.google.com with SMTP id w10-20020a056830280a00b0054e4e6c85a6so2586392otu.5; Wed, 13 Oct 2021 00:51:00 -0700 (PDT) X-Gm-Message-State: AOAM531piHKYS/FT7H9U5fF136dgLVYlgF5ruvY4pNDDsZ9LW2Qo90h7 46GtcZ+mzOdlk9XsZDPr9nzPHqLVKdrR6rbqRo8= X-Received: by 2002:a9d:7b48:: with SMTP id f8mr30224626oto.112.1634111459964; Wed, 13 Oct 2021 00:50:59 -0700 (PDT) MIME-Version: 1.0 References: <20211012082708.121931-1-iivanov@suse.de> <4eccf707f2553f0f66ae3789b5689231@suse.de> In-Reply-To: <4eccf707f2553f0f66ae3789b5689231@suse.de> From: Ard Biesheuvel Date: Wed, 13 Oct 2021 09:50:48 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RESEND] Re: [PATCH] Revert "efi/random: Treat EFI_RNG_PROTOCOL output as bootloader randomness" To: "Ivan T. Ivanov" Cc: Dominik Brodowski , linux-efi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Oct 2021 at 09:30, Ivan T. Ivanov 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);