On Thu, 20 May 2021 at 06:15, Philippe Mathieu-Daudé <f4...@amsat.org> wrote: > > If a address_space_write() call fails while calling > set_kernel_args(), the guest kernel will boot using > crap data. Avoid that by aborting if this ever occurs. > > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
> @@ -786,10 +811,16 @@ static void do_cpu_reset(void *opaque) > cpu_set_pc(cs, info->loader_start); > > if (!have_dtb(info)) { > + int err; > + > if (old_param) { > - set_kernel_args_old(info, as); > + err = set_kernel_args_old(info, as); > } else { > - set_kernel_args(info, as); > + err = set_kernel_args(info, as); > + } > + if (err) { > + error_report("could not set kernel arguments"); > + exit(1); > } > } > } else { Since this is in the 'reset' method it's in theory possible that we might end up exit()ing here in mid-run if the simulation does a reset and the second reset fails but the one on bootup didn't. But that seems pretty unlikely, and in any case this code is all in the "booting Linux, but no DTB" codepath, which is nowadays a pretty rare case. Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> thanks -- PMM