[PATCH v2] x86/setup: do not include kexec_handover.h from asm/setup.h
Borislav Petkov
bp at alien8.de
Fri Jul 3 10:38:10 PDT 2026
On Fri, Jul 03, 2026 at 06:23:33PM +0200, Pratyush Yadav wrote:
> On Fri, Jul 03 2026, Borislav Petkov wrote:
>
> > On Fri, Jul 03, 2026 at 04:37:03PM +0200, Pratyush Yadav wrote:
> >> From: "Pratyush Yadav (Google)" <pratyush at kernel.org>
> >>
> >> x86 asm/setup.h includes linux/kexec_handover.h. This is because it is
> >> used by setup.c and kaslr.c. But this inclusion is problematic. The
> >> header is included in many places, so it results in the KHO header being
> >> propagated there. Also, the setup header is used by realmode code. If
> >> KHO header includes things like mm.h, it causes a big dump of
> >> compliation failures.
> >
> >> Nothing in setup.h uses anything from KHO. Remove the header from
> >> setup.h, and directly include it in setup.c. which does use things from
> >> KHO. Since kaslr.c is a part of the decompressor, avoid including linux
> >> headers there directly. Instead, split out struct kho_scratch, which is
> >> the only thing the kaslr.c uses, and move it to
> >> include/asm-generic/kexec_handover.h.
> >>
> >> This change should also help reduce files recompiled when
> >
> >> kexec_handover.h changes.
> >>
> >> Signed-off-by: Pratyush Yadav (Google) <pratyush at kernel.org>
> >> ---
> >>
> >> Notes:
> >> Thomas/Ingo/Borislav/Dave, is it okay if we take this patch through the
> >
> > See my reply to Mike about using the generic-y infrastructure.
>
> To double check I got your point correctly, is this what you mean?
>
> diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> index ac02aed8757b..22267a83e064 100644
> --- a/arch/x86/boot/compressed/kaslr.c
> +++ b/arch/x86/boot/compressed/kaslr.c
> @@ -32,7 +32,7 @@
> #include <asm/setup.h> /* For COMMAND_LINE_SIZE */
> #undef _SETUP
>
> -#include <asm-generic/kexec_handover.h>
> +#include <asm/kexec_handover.h>
>
> extern unsigned long get_cmd_line_ptr(void);
>
> diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
> index 078fd2c0d69d..47ef8cb482e3 100644
> --- a/arch/x86/include/asm/Kbuild
> +++ b/arch/x86/include/asm/Kbuild
> @@ -15,3 +15,4 @@ generic-y += fprobe.h
> generic-y += mcs_spinlock.h
> generic-y += mmzone.h
> generic-y += ring_buffer.h
> +generic-y += kexec_handover.h
>
> --
Looks about right, AFAICT.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
More information about the kexec
mailing list