Re: [PATCH qemu] x86: don't let decompressed kernel image clobber setup_data

From: Borislav Petkov
Date: Sat Dec 31 2022 - 08:41:30 EST


On Fri, Dec 30, 2022 at 05:06:55PM -0800, H. Peter Anvin wrote:
> This needs to be something like:
>
> kernel_add_identity_map(sd_addr, sd_addr + sizeof(*sd));
> kernel_add_identity_map(sd_addr + sizeof(*sd),
> sd_addr + sizeof(*sd) + sd->len);

It still #PFs with that:

(gdb) bt
#0 0xffffffff84738576 in native_halt () at ./arch/x86/include/asm/irqflags.h:57
#1 halt () at ./arch/x86/include/asm/irqflags.h:98
#2 early_fixup_exception (regs=regs@entry=0xffffffff84007dc8, trapnr=trapnr@entry=14) at arch/x86/mm/extable.c:340
#3 0xffffffff846ff465 in do_early_exception (regs=0xffffffff84007dc8, trapnr=14) at arch/x86/kernel/head64.c:424
#4 0xffffffff846ff14f in early_idt_handler_common () at arch/x86/kernel/head_64.S:483
#5 0xc149f9894908788d in ?? ()
#6 0xffffffffff2003fc in ?? ()
#7 0x0000000000000010 in fixed_percpu_data ()
#8 0xdffffc0000000000 in ?? ()
#9 0xffffffff84007ea8 in init_thread_union ()
#10 0xffffffffff20088d in ?? ()
#11 0x0000000000000000 in ?? ()

/me goes to dig more.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette