Re: [tip: x86/urgent] x86/kexec: Use up-to-dated screen_info copy to fill boot params

From: Thomas Gleixner
Date: Tue Oct 27 2020 - 16:07:13 EST


On Wed, Oct 14 2020 at 15:43, tip-bot wrote:
> The following commit has been merged into the x86/urgent branch of tip:
> x86/kexec: Use up-to-dated screen_info copy to fill boot params
>
> kexec_file_load() currently reuses the old boot_params.screen_info,
> but if drivers have change the hardware state, boot_param.screen_info
> could contain invalid info.
>
> For example, the video type might be no longer VGA, or the frame buffer
> address might be changed. If the kexec kernel keeps using the old screen_info,
> kexec'ed kernel may attempt to write to an invalid framebuffer
> memory region.
>
> There are two screen_info instances globally available, boot_params.screen_info
> and screen_info. Later one is a copy, and is updated by drivers.
>
> /* Copying screen_info will do? */
> - memcpy(&params->screen_info, &boot_params.screen_info,
> - sizeof(struct screen_info));
> + memcpy(&params->screen_info, &screen_info, sizeof(struct screen_info));

Well, that's better than what we had before, but how is this correct
vs. the following sequence:

kexec_load()
change_screen()
kexec()

Hmm?

Thanks,

tglx