[PATCH 8/8] boot: fdt: downgrade KASLR RNG failure to warning
Jamie Gibbons
jamie.gibbons at microchip.com
Thu Jun 25 14:23:25 CEST 2026
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 at 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
More information about the U-Boot
mailing list