[Bug 300487] crash on resume if microcode update is configured and applicable

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 03 Nov 2026 18:35:56 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300487

            Bug ID: 300487
           Summary: crash on resume if microcode update is configured and
                    applicable
           Product: Base System
           Version: 15.1-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: avg@FreeBSD.org

The affected system runs on AMD processor and is configured to apply microcode
updates via preloaded image:

cpu_microcode_load="YES"
cpu_microcode_name="/boot/firmware/amd-ucode.bin"

Typically, I do not suspend the system, but it "happened".
On resume, the system crashed.

Thanks to serial console the crash got logged.

Fatal trap 9: general protection fault while in kernel mode^M
cpuid = 0; apic id = 00^M
instruction pointer     = 0x20:0xffffffff80d8736f^M
stack pointer           = 0x28:0xfffffe03172ce9c0^M
frame pointer           = 0x28:0xfffffe03172ce9f0^M
processor eflags        = resume, IOPL = 0^M
current thread          = 77297/552357 (acpiconf/acpiconf)^M
rdi: ffffffff820a35d6 rsi: 0000000000000001 rdx: 00000000ffffffff^M
rcx: 00000000c0010020  r8: ffffffff80f5d9bf  r9: ffffffff80fae827^M
rax: 00000000820a35d6 rbx: ffffffff820a35d6 rbp: fffffe03172ce9f0^M
r10: 0000000000000070 r11: ffffffff80efdb07 r12: 0000000000000000^M
r13: 000000000a201016 r14: 0000000000000000 r15: 0000000000000000^M
^M
^M
Fatal trap 9: general protection fault while in kernel mode^M
cpuid = 0; apic id = 00^M
instruction pointer     = 0x20:0xffffffff80dd993c^M
stack pointer           = 0x28:0xfffffe03172ce390^M
frame pointer           = 0x28:0xfffffe03172ce390^M
processor eflags        = resume, IOPL = 0^M
current thread          = 77297/552357 (acpiconf/acpiconf)^M
rdi: 0000000000004400 rsi: 0000000000000001 rdx: 0000000000000001^M
rcx: 0000000000000830  r8: 0000000000004401  r9: 0000000000000001^M
rax: 0000000000004400 rbx: 0000000000000000 rbp: fffffe03172ce390^M
r10: 0000000000000002 r11: fffffe03172ce341 r12: 000000000000fffc^M
r13: 0000000080000000 r14: 0000000000000001 r15: fffffe03172ce400^M

The second block repeated about 10 times after which the system just hung.

The first reported instruction pointer, 0xffffffff80d8736f, is in
ucode_amd_load:
   0xffffffff80d87361 <+65>:    mov    %rbx,%rdx
   0xffffffff80d87364 <+68>:    shr    $0x20,%rdx
   0xffffffff80d87368 <+72>:    mov    %ebx,%eax
   0xffffffff80d8736a <+74>:    mov    $0xc0010020,%ecx
   0xffffffff80d8736f <+79>:    wrmsr

It seems that the resume code applies microcode updates just like the boot code
does.
But it looks like the microcode image gets freed, via ucode_release(), after it
is used during the boot.
That was not a problem before commit base 16f21c5af350 (bug 294630) because the
image was copied into its own buffer, but now ucode_data and early_ucode_data
are left pointing to the released memory.

debug.ucode.release=0 can be used as a workaround.

-- 
You are receiving this mail because:
You are the assignee for the bug.