]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/kexec: Invoke copy of relocate_kernel() instead of the original
authorDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 5 Dec 2024 15:05:13 +0000 (15:05 +0000)
committerIngo Molnar <mingo@kernel.org>
Fri, 6 Dec 2024 09:41:59 +0000 (10:41 +0100)
commiteeebbde57113730db7b3ec7380ada61a0193d27c
tree630be05cdd39494e7f4317347bd761c373d9e258
parent6a750b4c009936f352aaac0366f5f10fcf51e81b
x86/kexec: Invoke copy of relocate_kernel() instead of the original

This currently calls set_memory_x() from machine_kexec_prepare() just
like the 32-bit version does. That's actually a bit earlier than I'd
like, as it leaves the page RWX all the time the image is even *loaded*.

Subsequent commits will eliminate all the writes to the page between the
point it's marked executable in machine_kexec_prepare() the time that
relocate_kernel() is running and has switched to the identmap %cr3, so
that it can be ROX. But that can't happen until it's moved to the .data
section of the kernel, and *that* can't happen until we start executing
the copy instead of executing it in place in the kernel .text. So break
the circular dependency in those commits by letting it be RWX for now.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Baoquan He <bhe@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lore.kernel.org/r/20241205153343.3275139-8-dwmw2@infradead.org
arch/x86/kernel/machine_kexec_64.c
arch/x86/kernel/relocate_kernel_64.S