Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: Process bootinfo records before saving them

The RNG seed boot record is memzeroed after processing, in order to
preserve forward secrecy. By saving the bootinfo for procfs prior to
that, forward secrecy is violated, since it becomes possible to recover
past states. So, save the bootinfo block only after first processing
them.

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-1-Jason@zx2c4.com
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

authored by

Jason A. Donenfeld and committed by
Geert Uytterhoeven
7c236d93 15f90423

+3 -2
+3 -2
arch/m68k/kernel/setup_mm.c
··· 109 109 110 110 static void __init m68k_parse_bootinfo(const struct bi_record *record) 111 111 { 112 + const struct bi_record *first_record = record; 112 113 uint16_t tag; 113 - 114 - save_bootinfo(record); 115 114 116 115 while ((tag = be16_to_cpu(record->tag)) != BI_LAST) { 117 116 int unknown = 0; ··· 180 181 tag); 181 182 record = (struct bi_record *)((unsigned long)record + size); 182 183 } 184 + 185 + save_bootinfo(first_record); 183 186 184 187 m68k_realnum_memory = m68k_num_memory; 185 188 #ifdef CONFIG_SINGLE_MEMORY_CHUNK