U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jamie Gibbons <jamie.gibbons@microchip.com>
To: <u-boot@lists.denx.de>
Cc: Conor Dooley <conor.dooley@microchip.com>,
	Valentina Fernandez Alanis
	<valentina.fernandezalanis@microchip.com>,
	Tom Rini <trini@konsulko.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Leo Yu-Chi Liang <ycliang@andestech.com>,
	Sughosh Ganu <sughosh.ganu@arm.com>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	Martin Herren <sputnik@on-the-web.ch>,
	Michal Simek <michal.simek@amd.com>,
	Adriana Nicolae <adriana@arista.com>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	<jamie.gibbons@microchip.com>
Subject: [PATCH 8/8] boot: fdt: downgrade KASLR RNG failure to warning
Date: Thu, 25 Jun 2026 13:23:25 +0100	[thread overview]
Message-ID: <20260625122325.834568-9-jamie.gibbons@microchip.com> (raw)
In-Reply-To: <20260625122325.834568-1-jamie.gibbons@microchip.com>

During early boot, dm_rng_read() may fail if the underlying RNG
is temporarily unavailable. This causes KASLR seeding to fail,
but does not affect boot correctness.

Currently, fdt_kaslrseed() treats this condition as a hard error
and logs an error message, even though the system continues to
boot normally.

Downgrade the failure to a warning and continue booting without
KASLR, making the behaviour explicit without implying a fatal
error.

Signed-off-by: Jamie Gibbons <jamie.gibbons@microchip.com>
---
 boot/fdt_support.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 1c215e548db..aba1841a9f5 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -308,9 +308,16 @@ int fdt_kaslrseed(void *fdt, bool overwrite)
 		return err;
 	}
 	err = dm_rng_read(dev, &data, sizeof(data));
-	if (err) {
-		dev_err(dev, "dm_rng_read failed: %d\n", err);
-		return err;
+	if (err < 0) {
+		/*
+		* RNG may be unavailable during early boot.
+		* KASLR is best-effort in this case; warn and continue.
+		*/
+		dev_warn(dev, "KASLR seed unavailable (RNG error %d), continuing without KASLR\n", err);
+		return 0;
+	} else if (err != sizeof(data)) {
+		dev_warn(dev, "KASLR seed unavailable (no entropy), continuing without KASLR\n");
+		return 0;
 	}
 	err = fdt_setprop(fdt, nodeoffset, "kaslr-seed", &data, sizeof(data));
 	if (err < 0)
-- 
2.43.0


  parent reply	other threads:[~2026-06-25 13:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 12:23 [PATCH 0/8] MPFS: add hardware RNG support and fix RNG consumers Jamie Gibbons
2026-06-25 12:23 ` [PATCH 1/8] cmd: rng: fix error handling for dm_rng_read() Jamie Gibbons
2026-06-25 14:38   ` Simon Glass
2026-06-25 12:23 ` [PATCH 2/8] misc: mpfs_syscontroller: add mailbox RX helper for service responses Jamie Gibbons
2026-07-01  9:45   ` Conor Dooley
2026-06-25 12:23 ` [PATCH 3/8] misc: mpfs_syscontroller: bind RNG sub-device Jamie Gibbons
2026-07-01  9:52   ` Conor Dooley
2026-06-25 12:23 ` [PATCH 4/8] rng: add Microchip PolarFire SoC hardware RNG driver Jamie Gibbons
2026-07-01  9:55   ` Conor Dooley
2026-06-25 12:23 ` [PATCH 5/8] configs: microchip_mpfs_generic: enable MPFS RNG support Jamie Gibbons
2026-07-01 10:04   ` Conor Dooley
2026-06-25 12:23 ` [PATCH 6/8] mailbox: mpfs-mbox: replace unbounded BUSY polling with bounded waits Jamie Gibbons
2026-07-01 10:05   ` Conor Dooley
2026-06-25 12:23 ` [PATCH 7/8] mailbox: mpfs: add bounded wait for BUSY to clear before sending request Jamie Gibbons
2026-07-01 10:06   ` Conor Dooley
2026-06-25 12:23 ` Jamie Gibbons [this message]
2026-06-25 14:38   ` [PATCH 8/8] boot: fdt: downgrade KASLR RNG failure to warning Simon Glass

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=20260625122325.834568-9-jamie.gibbons@microchip.com \
    --to=jamie.gibbons@microchip.com \
    --cc=adriana@arista.com \
    --cc=conor.dooley@microchip.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=michal.simek@amd.com \
    --cc=semen.protsenko@linaro.org \
    --cc=sputnik@on-the-web.ch \
    --cc=sughosh.ganu@arm.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=valentina.fernandezalanis@microchip.com \
    --cc=xypron.glpk@gmx.de \
    --cc=ycliang@andestech.com \
    /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