i386: pass rng seed via setup_data
Subsystems (2)
PATCH 1/1 i386: pass rng seed via setup_data
Linux ≥5.20 expects a RNG seed via setup_data as of the upstream commit in the link below. That commit adjusts kexec_file_load to pass SETUP_RNG_SEED. kexec-tools should follow suite, so add more or less the same code here.
Signed-off-by Jason A. Donenfeld <[email protected]>
--- kexec/arch/i386/x86-linux-setup.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
kexec/arch/i386/x86-linux-setup.c +25 -0
@@ -24,6 +24,7 @@#include <limits.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/random.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/fb.h>
@@ -544,6 +545,7 @@ struct setup_data {#define SETUP_DTB 2#define SETUP_PCI 3#define SETUP_EFI 4 +#define SETUP_RNG_SEED 9uint32_t len;uint8_t data[0 ]; } __attribute__((packed));
@@ -824,6 +826,26 @@ static void setup_e820(struct kexec_info *info, struct x86_linux_param_header *r } } +static void setup_rng_seed (struct kexec_info *info, +struct x86_linux_param_header *real_mode) +{ +struct { +struct setup_data header; +uint8_t rng_seed[32 ]; + } *sd; + + sd =xmalloc (sizeof (*sd)); + sd->header.next =0 ; + sd->header.len =sizeof (sd->rng_seed); + sd->header.type =SETUP_RNG_SEED ; + +if (getrandom (sd->rng_seed,sizeof (sd->rng_seed),GRND_NONBLOCK ) != +sizeof (sd->rng_seed)) +return ;/* Not initialized, so don't pass a seed. */ + +add_setup_data (info, real_mode, &sd->header); +} +static int get_efi_mem_desc_version (struct x86_linux_param_header *real_mode) {
@@ -923,6 +945,9 @@ void setup_linux_system_parameters(struct kexec_info *info,setup_e820 (info, real_mode); +/* pass RNG seed */ +setup_rng_seed (info, real_mode); +/* fill the EDD information */ setup_edd_info (real_mode);
Signature · 7 lines
2.35.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedQuoted 7 lines · Jason A. Donenfeld
Linux ≥5.20 expects a RNG seed via
setup_dataas of the upstream commit in the link below. That commit adjustskexec_file_loadto passSETUP_RNG_SEED. kexec-tools should follow suite, so add more or less the same code here.
Thanks, applied.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec