diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-10-03 09:48:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-10-03 09:48:47 -0700 |
commit | 75003fa726e990883bba5b38c4c4d873dab45d62 (patch) | |
tree | 869b11536ebca07d49ed26a4bb60a3295904762c /arch/m68k/kernel/setup_mm.c | |
parent | fb443f36f3b9af6a4590b6e65e2d7affdfe0da18 (diff) | |
parent | dc63a086daee92c63e392e4e7cd7ed61f3693026 (diff) | |
download | linux-stable-75003fa726e990883bba5b38c4c4d873dab45d62.tar.gz linux-stable-75003fa726e990883bba5b38c4c4d873dab45d62.tar.bz2 linux-stable-75003fa726e990883bba5b38c4c4d873dab45d62.zip |
Merge tag 'm68k-for-v6.1-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k updates from Geert Uytterhoeven:
- Fix forward secrecy of RNG seed boot record handling
- Make RNG seed boot record handling generic for all m68k platforms
using bootinfo
- defconfig updates
- Minor fixes and improvements
* tag 'm68k-for-v6.1-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
m68k: Rework BI_VIRT_RNG_SEED as BI_RNG_SEED
m68k: Process bootinfo records before saving them
m68k: defconfig: Update defconfigs for v6.0-rc2
m68k: Allow kexec on M68KCLASSIC with MMU enabled only
m68k: Move from strlcpy with unused retval to strscpy
Diffstat (limited to 'arch/m68k/kernel/setup_mm.c')
-rw-r--r-- | arch/m68k/kernel/setup_mm.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index e62fa8f2149b..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> @@ -109,10 +110,9 @@ extern void paging_init(void); static void __init m68k_parse_bootinfo(const struct bi_record *record) { + const struct bi_record *first_record = record; uint16_t tag; - save_bootinfo(record); - while ((tag = be16_to_cpu(record->tag)) != BI_LAST) { int unknown = 0; const void *data = record->data; @@ -148,10 +148,21 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record) break; case BI_COMMAND_LINE: - strlcpy(m68k_command_line, data, + strscpy(m68k_command_line, data, 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); @@ -182,6 +193,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record) record = (struct bi_record *)((unsigned long)record + size); } + save_bootinfo(first_record); + m68k_realnum_memory = m68k_num_memory; #ifdef CONFIG_SINGLE_MEMORY_CHUNK if (m68k_num_memory > 1) { |