kern/amd64/machdep: Replace memset in wrmsr_early_safe_end

GENERIC-KASAN kernel failed to boot on a Dell PowerEdge C6615 with
an AMD EPYC 8224P CPU; UEFI BIOS caught a #GP exception with %RIP
in kasan_memset where %GS relative pointer (curthread->td_pflags2)
was dereferenced. Investigation led to wrmsr_early_safe_end which
calls memset to clear early #GP IDT entry. Replacing memset with
__builtin_memset_inline still resulted in the compiler emitting a
call to the memset resolver in GENERIC-KASAN build and the kernel
stil faulted during boot. This version which has been successfully
tested with both GENERIC and GENERIC-KASAN kernels uses memset_early.

Signed-off-by: Kristofer Peterson <kris@tranception.com>
Reviewed-by: kib
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2069
This commit is contained in:
Kristofer Peterson
2026-03-09 15:40:34 -04:00
committed by Kyle Evans
parent 930a790c2a
commit 615f1b9eb1
+1 -1
View File
@@ -1850,7 +1850,7 @@ wrmsr_early_safe_end(void)
lidt(&wrmsr_early_safe_orig_efi_idt);
gpf_descr = &idt0[IDT_GP];
memset(gpf_descr, 0, sizeof(*gpf_descr));
memset_early(gpf_descr, 0, sizeof(*gpf_descr));
}
#ifdef KDB