aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel/setup_mm.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-09-27 15:08:35 +0200
committerGeert Uytterhoeven <geert@linux-m68k.org>2022-09-28 22:16:44 +0200
commitdc63a086daee92c63e392e4e7cd7ed61f3693026 (patch)
tree587dc01cb12c5e104a71f321bbb8f573892d323e /arch/m68k/kernel/setup_mm.c
parentm68k: Process bootinfo records before saving them (diff)
downloadlinux-dev-dc63a086daee92c63e392e4e7cd7ed61f3693026.tar.xz
linux-dev-dc63a086daee92c63e392e4e7cd7ed61f3693026.zip
m68k: Rework BI_VIRT_RNG_SEED as BI_RNG_SEED
This is useful on !virt platforms for kexec, so change things from BI_VIRT_RNG_SEED to be BI_RNG_SEED, and simply remove BI_VIRT_RNG_SEED because it only ever lasted one release, and nothing is broken by not having it. At the same time, keep a comment noting that it's been removed, so that ID isn't reused. In addition, we previously documented 2-byte alignment, but 4-byte alignment is actually necessary, so update that comment. Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Fixes: a1ee38ab1a75 ("m68k: virt: Use RNG seed from bootinfo block") Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Link: https://lore.kernel.org/r/20220927130835.1629806-2-Jason@zx2c4.com Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k/kernel/setup_mm.c')
-rw-r--r--arch/m68k/kernel/setup_mm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 78967c96ee8f..3a2bb2e8fdad 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/nvram.h>
#include <linux/initrd.h>
+#include <linux/random.h>
#include <asm/bootinfo.h>
#include <asm/byteorder.h>
@@ -151,6 +152,17 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
sizeof(m68k_command_line));
break;
+ case BI_RNG_SEED: {
+ u16 len = be16_to_cpup(data);
+ add_bootloader_randomness(data + 2, len);
+ /*
+ * Zero the data to preserve forward secrecy, and zero the
+ * length to prevent kexec from using it.
+ */
+ memzero_explicit((void *)data, len + 2);
+ break;
+ }
+
default:
if (MACH_IS_AMIGA)
unknown = amiga_parse_bootinfo(record);