Laptop stopped booting. Disabling two lines from loader.conf solved it. /boot/loader.conf: #cpu_microcode_load="YES" #cpu_microcode_name="/boot/firmware/intel-ucode.bin" ----- $ pkg info cpu-microcode-intel cpu-microcode-intel-20260227 Name : cpu-microcode-intel Version : 20260227 Installed on : Thu Apr 9 14:13:31 2026 CDT Origin : sysutils/cpu-microcode-intel Architecture : FreeBSD:15:* Prefix : /usr/local Categories : sysutils Licenses : EULA Maintainer : jrm@FreeBSD.org WWW : https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files Comment : Intel CPU microcode updates Options : RC : off SPLIT : on Annotations : build_timestamp: 2026-04-04T01:13:38+0000 built_by : poudriere-git-3.4.6-4-g83739588 cpe : cpe:2.3:o:intel:microcode:20260227:::::freebsd15:x64 port_checkout_unclean: no port_git_hash : 78db3aeaafd6e8351d3fa52693f922e0020da12f ports_top_checkout_unclean: no ports_top_git_hash: 78db3aeaafd6e8351d3fa52693f922e0020da12f repo_type : binary repository : FreeBSD-ports Flat size : 30.2MiB Description : This port uses the cpuctl(4) microcode update facility to keep your Intel processor's firmware up-to-date. Updating your microcode can help to mitigate certain potential security vulnerabilities in CPUs as well as address certain functional issues that could, for example, result in unpredictable system behavior such as hangs, crashes, unexpected reboots, data errors, etc. ----- $ lscpu Architecture: amd64 Byte Order: Little Endian Total CPU(s): 8 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 Vendor: GenuineIntel CPU family: 6 Model: 60 Model name: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz Stepping: 3 L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 6M Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 cflsh ds acpi mmx fxsr sse sse2 ss htt tm pbe sse3 pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline aes xsave osxsave avx f16c rdrnd fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid fpcsds syscall nx pdpe1gb rdtscp lm lahf_lm lzcnt ---- $ uname -a FreeBSD envy 15.0-RELEASE-p5 FreeBSD 15.0-RELEASE-p5 GENERIC amd64
Hello, Thanks for reporting. We haven't received any other reports, so there might be an issue that's specific to your CPU. I don't have access to this CPU to debug, so we'll have to work together to try to understand what's going on. - First, could you explain in more detail how your laptop stopped booting? For example, does it panic on boot? - If you install cpu-microcode-rc, and do `service microcode_update onestart`, can you report what you see at the console? - Does `pkg check -s cpu-microcode-intel` report anything interesting? What does `sha256 /boot/firmware/intel-ucode.bin` report? - Has this been working for you in the past? If so, do you have any idea what triggered the issue? Did the failure coincide with a pkg upgrade, a BIOS update, or a kernel update? I don't see any recent changes to the microcode for your CPU, and nothing has changed in how FreeBSD applies it, so perhaps something else may have changed on your system around the same time.
Hello @jrm! Let's see. It worked fine for about a week. When it failed, it was a hard lock up very early after pressing "1" from the loader prompt. I don't have a way to capture where this was in the boot sequence. A power cycle was required to un-freeze the machine. To recover, I reverted to the previous boot environment that did not have the microcode entries in /boot/loader.conf (like 15-0-RELEASE-p4). I then mounted the failing BE, and edited the loader.conf file to disable those two lines. I've been running that way in 15.0-RELEASE-p5 since reporting this bug. Today, I upgraded to 15-RELEASE-p6. After successfully upgrading, I re-enabled the microcode entries in loader.conf. Reboot was successful. On thing is - on the days it failed, the temperature was very cold. Today I did the upgrade after the machine had been powered up for some hours. This might be an issue with aging hardware (11+ years old). I'll keep an eye on this and report back with any news.
Got crash today after updating to 2026-05-12 loading with loader.conf. I've switch to rc and it runs fine (rebooted and fine again). https://lists.freebsd.org/archives/freebsd-current/2026-May/010248.html
Update of cpu-microcode-intel: 20260227 -> 20260512 prevented my 15.0-RELEASE-p8 headless server from successfully booting, instead it hanged after EFI framebuffer information: addr, size 0x90000000, 0x30000000 dimensions 1024 x 768 stride 1024 masks 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 I managed to boot by typing unload all load /boot/kernel/kernel load /boot/kernel/opensolaris.ko load /boot/kernel/zfs.ko boot at the boot loader prompt. Then I deleted cpu-microcode-intel and removed the lines cpu_microcode_load="YES" cpu_microcode_name="/boot/firmware/intel-ucode.bin" from /boot/loader.conf. After this the server booted normally. The server lives in a datacenter, it was created on 1st December 2025, so it survived a couple of updates of cpu-microcode-inte. FreeBSD boots using UEFI. # uname -a FreeBSD xxxxx 15.0-RELEASE-p8 FreeBSD 15.0-RELEASE-p8 GENERIC amd64 The hardware is Supermicro X11SCL-F (BIOS revision 2.5 07/01/2024) Intel Xeon E-2236 2x16 GB DDR4 ECC # lscpu Architecture: amd64 Byte Order: Little Endian Total CPU(s): 12 Thread(s) per core: 2 Core(s) per socket: 6 Socket(s): 1 Vendor: GenuineIntel CPU family: 6 Model: 158 Model name: Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz Stepping: 10 L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 12M Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 cflsh ds acpi mmx fxsr sse sse2 ss htt tm pbe sse3 pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline aes xsave osxsave avx f16c rdrnd fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm fpcsds mpx rdseed adx smap clflushopt intel_pt syscall nx pdpe1gb rdtscp lm lahf_lm lzcnt
Created attachment 270826 [details] Do not use wrmsr_early... for Intel CPUs Do not use wrmsr_early... for Intel CPUs.
Thanks to everyone for reporting. Obvious temporary workaround for affected users: Since loading via cpucontrol(8) is unaffected, you could remove the cpu_microcode_load and cpu_microcode_name lines from /boot/loader.conf, install sysutils/cpu-microcode-rc, and enable the RC script instead. The problem doesn't seem to be with the microcode itself because: - the microcode for these CPUs hasn't changed between the 20260227 and 20260512 releases - there are no new upstream bug reports - late loading with the RC script works for Nuno There have been some suspicious kernel changes to both main and stable/15: - a319696875 / d4f91b6d25cb: amd64: add wrmsr_early_safe(9) - d9f03a43f2fec / b8975e052e80: ucode: use wrmsr_early_safe() for early CPU microcode update - fee3eba10f / 615f1b9eb17c: kern/amd64/machdep: Replace memset in wrmsr_early_safe_end My money is on d9f03a43f2fec, especially since the commit messages say, "This has been tested only on AMD booted in EFI mode." My understanding is that the wrmsr_early_safe mechanism was designed for an AMD-specific problem. Certain EPYC CPUs issue a #GP when the OS attempts to load microcode before a minimum BIOS-level microcode version is applied. Intel's MSR_BIOS_UPDT_TRIG does not do this, so maybe this fault-handling is unnecessary for Intel (and introduces risk without benefit). The attached (untested) patch makes the EARLY case in ucode_intel_load() fall through to a bare wrmsr(), restoring the pre-October-2025 behavior for Intel. I'll add glebius@, kib@, markj@ (and emaste@) because they worked in this area and understand the code.
I started a review at https://reviews.freebsd.org/D57054. My naive attempt there seems to be incorrect, which is often the best strategy to get everyone's attention. For anyone with an affected system, could you try the experiment that kib@ asked about? 1. I think everyone here is running 15.0 release (Nuno, I don't think you specified, so I'm guessing), so check out releng/15.0. git checkout releng/15.0 2. Apply the experimental patch from @kib (will attach in a moment) 3. Build a new kernel with the patch cd /usr/src make -j$(sysctl -n hw.ncpu) buildkernel make installkernel INSTKERNNAME=kernel.test DESTDIR=/ 4. Make sure you have the original lines in /boot/loader.conf cpu_microcode_load="YES" cpu_microcode_name="/boot/firmware/intel-ucode.bin" 5. Report back whether the system now boots with the latest Intel CPU microcode.
Created attachment 270839 [details] Experimental patch to skip WRMSR
(In reply to Joseph Mingrone from comment #7) I'm on 16 main-n285772-d9b272a19d39 (Fri May 8). Is there a possibility that I try same patch?
(In reply to Nuno Teixeira from comment #9) Yes, please. In step 1, instead of being on releng/15.0, start on main. Everyone should also do a `git pull` after checking out the branch.
(In reply to Joseph Mingrone from comment #10) Same crash with n285772-d9b272a19d39-dirty (Experimental patch to skip WRMSR). Should I try the other patch too? I have machine ready for faster testing.
(In reply to Nuno Teixeira from comment #11) Thanks Nuno. If you're able to try the other patch, it could be helpful.
(In reply to Joseph Mingrone from comment #12) Same crash with "Do not use wrmsr_early... for Intel CPUs" patch
As I remember, crash happened when I upgraded cpu-microcode port and rebooted. That was in main-n285772-d9b272a19d39 and I'm still using it. I could do some tests on port itself by reverting latest updates or I can revert some src commits locally for some testing. ports: 8972ab311c (sysutils/cpu-microcode*: support early loading of AMD ucode) src: d9f03a43f2fe (ucode: use wrmsr_early_safe() for early CPU microcode update) a31969687545 (amd64: add wrmsr_early_safe(9)) Any hints on what I should do?
(In reply to Nuno Teixeira from comment #14) You could try reverting sysutils/cpu-microcode-intel to 165891aa1d131e49d67355778bb22e0c6a4580b3 (the commit before the cpu-microcode-intel update to the 2026-05-12 release) and rebuild/reinstall. You said your CPU was an Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (2600.00-MHz K8-class CPU). According to https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/tag/microcode-20260512 nothing changed for your CPU, so I wouldn't expect that update to change anything, but maybe I'm missing something.
(In reply to Joseph Mingrone from comment #15) Revert "sysutils/cpu-microcode-intel: Update to 2026-05-12 release" This reverts commit 64880edb1ae15b052b6bbf7e2cfaafde907557c2. ... VT(efifb): resolution 1920x1080 CPU microcode: updated from 0xf6 to 0x100 CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (2600.00-MHz K8-class CPU) ... Soon I will upgrade world and I will do revert/restore 2026-05-12 to check results.
The "Experimental patch to skip WRMSR" resolved my problem (comment #4), the system booted normally. dmesg reads: CPU microcode: no matching update found # uname -a FreeBSD xxxxx 15.0-RELEASE-p8 FreeBSD 15.0-RELEASE-p8 #0 releng/15.0-n281036-53054229dcb3-dirty: Tue May 19 00:44:52 MSK 2026 toor@xxxxx:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
Addition to my comment. As I wrote my system booted with the patch, but microcode was not updated. The current microcode version is 0xf8 # cpupdate -i Found CPU(s) from Intel Core 0 to 11: CPUID: 906ea Fam 06 Mod 9e Step 0a Flag 02 uCode 000000f8 But the latest microcode for my CPU Intel Xeon E-2236 is 0xfa (as I see on a linux server with the same CPU).
One more addition. I downgraded cpu-microcode-intel to 20260227. In this case the microcode is actu ally updated: dmesg reads: CPU microcode: updated from 0xf8 to 0xfa # cpupdate -i Found CPU(s) from Intel Core 0 to 11: CPUID: 906ea Fam 06 Mod 9e Step 0a Flag 02 uCode 000000fa
(In reply to Alexander Verbovetsky from comment #19) I am lost in all the messages. Do I read the reports correct that commenting out the WRMSR instruction in wrmsr_early_safe() prevented crash? Of course the ucode should not be updated in this case, because the command that makes the update is commented out. If the above is true, can you try to - do not load any ucode from the loader - after kernel is up, load the latest (possibly faulting) ucode using cpuctl. Does the machine survive and ucode get updated?
(In reply to Konstantin Belousov from comment #20) Sorry! Yes, commenting out the WRMSR instruction in wrmsr_early_safe() prevented the crash. I tested both the patched and unpatched kernels with no microcode lines in /boot/loader.conf. With latest (20260512) cpu-microcode-intel installed I did service microcode_update onestart and the server survived and microcode got updated.
(In reply to Alexander Verbovetsky from comment #21) Ok so we know that: - late loading of the ucode succeed - not loading the ucode but keeping wrmsr_early_safe setup around does not fault Was there some previous version of kernel that boots with the early ucode load?
(In reply to Konstantin Belousov from comment #22) This server was always on 15.0-RELEASE and early ucode load. There were no problems till 20260512 version of cpu-microcode-intel.
(In reply to Alexander Verbovetsky from comment #23) Thanks for confirming. In other words, the problem is definitely not with the wrmsr_early_safe(), but it seems that the early ucode load causes an issue with this specific update. It is very hard to guess what is the problem, for instance it might be that CPU does not like that the other thread is parked. I remember there were some recommendations about lock-step updates for older architectures.
*** Bug 295556 has been marked as a duplicate of this bug. ***
I was not seeing this issue on 15.0-RELEASE-p?, but I am seeing it on 15.1-RC1. Note "copy_staging enable" also unblocks the boot, that may be a better workaround than loading ucode later.
The "copy_staging enable" workaround works for me too.
Maybe a dumb question, but since "copy_staging enable" is known to fix the issue -- is it possible that this is related to the memory layout of the microcode? For example if it's contiguous in virtual address space but not contiguous in physical address space, and copy_staging happens to "defragment" it? That's exactly the sort of bug which would cause this sort of "some systems work and some don't" behaviour.
(In reply to Colin Percival from comment #28) It is always phys-contigous. I am interested if increasing the slop size fixes the boot.
(In reply to Konstantin Belousov from comment #29) I don't quite understand what increasing the slop size means. I tried staging_slop 134217728 at the loader prompt and it fixed the boot. I tried a few lower values (the highest being 112M), but they didn't fix. Adding exec="staging_slop 134217728" to /boot/loader.conf fixes as well.
(In reply to Alexander Verbovetsky from comment #30) I can confirm that it boots OK: main-n286085-c74645b0c8df (Sat May 23) cpu-microcode-intel-20260512 ... CPU microcode: updated from 0xf6 to 0x100 CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (2600.00-MHz K8-class CPU) ... > Adding > exec="staging_slop 134217728" > to /boot/loader.conf fixes as well.
One thing to try is https://reviews.freebsd.org/D57264 It should not make the ucode load, but might fix the reset.
(In reply to Konstantin Belousov from comment #32) For me D57264 fixes the boot and load ucode. FreeBSD xxxxx 15.0-RELEASE-p9 FreeBSD 15.0-RELEASE-p9 #1 releng/15.0-n281048-6d536196f1bd-dirty: Wed May 27 21:40:29 MSK 2026 toor@xxxxx:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 # dmesg | grep microcode CPU microcode: updated from 0xf8 to 0xfa # cat /boot/loader.conf | grep microcode cpu_microcode_load="YES" cpu_microcode_name="/boot/firmware/intel-ucode.bin"
D57264 doesn't work for me on main-n286192-ccda002ca10f-dirty (Wed May 27). - applied D57264.patch - make buildkernel-jobs - make installkernel - reboot Still using exec="staging_slop 134217728" to fix boot and load microcode.
*** Bug 295463 has been marked as a duplicate of this bug. ***
I see this in Oracle cloud on 2 tiny x86 VMs, & can reproduce it on 15.0p9 when using the 15.1-RC1 boot loader *and* the microcode 20251202 in loader.conf. - loaading the microcode later via rc.conf or just root shell shows me ``` login: CPU: AMD EPYC 7551 32-Core Processor (1996.25-MHz K8-class CPU) Origin="AuthenticAMD" Id=0x800f12 Family=0x17 Model=0x1 Stepping=2 Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT> Features2=0xfff83203<SSE3,PCLMULQDQ,SSSE3,FMA,CX16,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND,HV> AMD Features=0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM> AMD Features2=0xc003f7<LAHF,CMP,SVM,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,Topology,PCXC> Structured Extended Features=0x209c01ab<FSGSBASE,TSCADJ,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA> Structured Extended Features3=0x20000000<ARCH_CAP> XSAVE Features=0x7<XSAVEOPT,XSAVEC,XINUSE> IA32_ARCH_CAPS=0x69<RDCL_NO,SKIP_L1DFL_VME,MDS_NO> AMD Extended Feature Extensions ID EBX=0x2001005<CLZERO,XSaveErPtr,IBPB,VIRT_SSBD> SVM: NP,NRIP,NAsids=16 Hypervisor: Origin = "KVMKVMKVM" ``` I'll try the patches for 15.1* later today.
- adding `exec="staging_slop 134217728"` to loader.conf for 15.1-RELEASE works for me
This seems to work for me too on a Baytrail chipset (J1900 cpu). I am pretty sure I had run into this before as well a few months ago. At the time, I changed the boot process to legacy to avoid EFI and it worked and chalked it up to some BIOS bug. Not sure why that is the case. But I had 6 of ~ 50 boxes all of a sudden run into this when I updated to the latest 14 patch level along with the updated microcode. Whats odd is that it was not ALL my boxes, just some even though they all have the same BIOS version according to dmidecode. On the one box I got back from the field I switch it to legacy boot and was able to successfully reboot for 500+ cycles. (shutdown -r now, boot up, sleep random period between 60-360 seconds, shutdown -r now). When I saw this bug, I thought I would try it as well and re-enable efi and it worked with exec="staging_slop 134217728". But now that I commented it out, its still working, so not sure why this is so transient all of a sudden. But like I said, I have about 50 other identical boxes all rebooted ok in the field without issue. kern.geom.label.disk_ident.enable="0" kern.geom.label.gptid.enable="0" cryptodev_load="YES" zfs_load="YES" cpu_microcode_load="YES" cpu_microcode_name="/boot/firmware/intel-ucode.bin" coretemp_load="YES" pf_load="YES" pflog_load="YES" ichwd_load="YES" beastie_disable="YES" autoboot_delay="2" kern.cam.ada.0.delete_method=DSM_TRIM beastie_disable="YES" #hw.syscons.disable="1" exec="staging_slop 134217728" ---<<BOOT>>--- Copyright (c) 1992-2023 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 14.4-RELEASE-p5 GENERIC amd64 FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2) VT(efifb): resolution 640x480 CPU microcode: updated from 0x837 to 0x838 CPU: Intel(R) Celeron(R) CPU J1900 @ 1.99GHz (2000.08-MHz K8-class CPU) Origin="GenuineIntel" Id=0x30678 Family=0x6 Model=0x37 Stepping=8 Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> Features2=0x41d8e3bf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,TSCDLT,RDRAND> AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM> AMD Features2=0x101<LAHF,Prefetch> Structured Extended Features=0x2282<TSCADJ,SMEP,ERMS,NFPUSG> Structured Extended Features3=0xc000400<MD_CLEAR,IBPB,STIBP> VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID TSC: P-state invariant, performance statistics real memory = 8589934592 (8192 MB) avail memory = 8133853184 (7757 MB) Event timer "LAPIC" quality 600 ACPI APIC Table: <ALASKA A M I > WARNING: L1 data cache covers fewer APIC IDs than a core (0 < 1) FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs FreeBSD/SMP: 1 package(s) x 4 core(s) random: registering fast source Intel Secure Key RNG random: fast provider: "Intel Secure Key RNG" random: unblocking device. Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe0Block: 128/32 (20221020/tbfadt-748) ioapic0 <Version 2.0> irqs 0-86 Launching APs: 2 1 3 random: entropy device external interface
(In reply to Dave Cottlehuber from comment #37) Dave, what was the previous value for staging_slop? Default is 8MB, and if it was not increased before, microcode destroyed memory structures of UEFI that later would be used by kernel. The man page loader.efi(8) does not state clearly that microcode is loaded to memory reserved by staging_slop. The Intel microcode grew from 32Kb to 16Mb in the last 10 years. This hang is random due to random damage to the UEFI memory (modules loaded in different order, etc.). It could have allocations without handles in the beginning of every allocation, and blocks with handles before free pages – if the latter are damaged, UEFI hangs when the kernel is going to prepare the memory map from UEFI allocations. I suppose there is no problem with microcode loading; the problem is with the default value of staging_slop and the absence of a clear requirement in the documentation to increase it with the increasing size of microcode.
(In reply to Vladlen Popolitov from comment #39) Microcode is not loaded into slop, it is passed together with any other loaded blobs and metadata. Slop indeed should prevent overwriting anything interesting that might be located right after the kernel+blobs, because very early allocator directly consumes the memory in slop. The early allocator is running even before the kernel page tables are constructed, and one of its duties is to provide pages for kernel page tables and early BSP PCPU area. It might be interesting to know if EFIRT is enabled or efirt.ko is loaded on the machines where the fault occurs, since otherwise most of the UEFI structures are not used. On the other hand, ACPI tables are used. And another point, both UEFI data and ACPI tables are accessed and parsed much later in the boot stage, when the console is already functional (at least serial console with debug.late_console=0).
(In reply to Konstantin Belousov from comment #40) May be I understood something wrong, but I see that in ucode_load_bsp() microcode is copied to the slop memcpy_early(addr, match, len); 'match' is verified address of microcode in the memory (yes, it is placed together with modules in the staging area, but it is not loaded to CPU from that address) 'addr' is the same address as passed by free (not changed and not verified for alignment in amd64 arch). It is sys/x86/x86/ucode.c line 461 in main. I can be wrong, it is how understand this code now. I suppose, 'free' point into slop are on this stage.
Created attachment 271353 [details] amd64: there is no reason to copy ucode around in ucode_load_bsp()
(In reply to Vladlen Popolitov from comment #41) Ohm, this might be it. Anybody who can reproduce it, please try the 'no reason to copy' patch. I did not tested, so there might be bugs in the patch itself even if the cause is nailed down.
(In reply to Konstantin Belousov from comment #43) For me 'no reason to copy' patch fixes the boot and loads ucode. # uname -a FreeBSD xxxxx 15.0-RELEASE-p9 FreeBSD 15.0-RELEASE-p9 #2 releng/15.0-n281048-6d536196f1bd-dirty: Sat May 30 20:04:49 MSK 2026 toor@xxxxx:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 # dmesg | grep microcode CPU microcode: updated from 0xf8 to 0xfa
Patch "noreason" doesn't fix my case without `exec="staging_slop 134217728"` at main-n286292-c115aad996d5-dirty (Sat May 30) ... VT(efifb): resolution 1920x1080 CPU microcode: updated from 0xf6 to 0x100 CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (2600.00-MHz K8-class CPU) ...
(In reply to Nuno Teixeira from comment #45) I did not see exact patch, I suppose it skips copy of microcode, what is logical. If it skips it, then your bad and good case differ only in assigning of staging_slop variable, that free some memory, increase staging_area and load modules into bigger staging_area. Could you check the total size of your loaded modules? Default is 64Mb(area) + 8mb(slop). If you have big modules plus increased microcode file, they could exceed this limit. Only ZFS takes 8MB, plus big microcode file. I do not have exact size for 0x100 version, but I saw somethng like 30MB from reports. You can see modules size reported by loader, if set in loader.conf: set module_verbose="3" For me it looks more and more as the problem with alocation of the memory in loader - just not enough memory for all modules and microcode. it does not look like problem with microcode and CPU.
(In reply to Vladlen Popolitov from comment #46) There is definitely more than one issue. Diagnosing them even with physical machine access and serial console would be quite hard. The best I can propose ATM is to put the infinite loop at consequent kernel bootstrap locations and localize where the reset occurs. Then we could try to make a guess. Meantime I put the 'no reason to copy' patch for review at https://reviews.freebsd.org/D57368 because I believe that it fixes a real issue.
(In reply to Vladlen Popolitov from comment #46) Using module_verbose="3", video recording and a screenshot :) https://people.freebsd.org/~eduardo/mpv-shot0001.jpg Could you take a look?
Sorry for the ignorant question, but: Is there any reason not to increase this slop thing by *a lot*? Just to preemptively avoid similar problems when the size of the microcode increases again in the future? For example, does the memory allocated for this stuff at boot time remain allocated for it thereafter, perhaps even indefinitely? I wouldn't want to do this if so, but if it's all just reclaimed after booting has finished... why not?
(In reply to Nuno Teixeira from comment #48) If you comment out the WRMSR instruction in the amd64/support.S function wrmsr_early_safe, does the machine boot?
(In reply to Konstantin Belousov from comment #50) Like this? ```diff --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -1564,16 +1564,17 @@ msr_onfault: movl $EFAULT,%eax POP_FRAME_POINTER ret - -ENTRY(wrmsr_early_safe) - movq %rsp,%r11 - movl %edi,%ecx - movl %esi,%eax - sarq $32,%rsi - movl %esi,%edx - wrmsr - xorl %eax,%eax - ret +/* + * ENTRY(wrmsr_early_safe) + * movq %rsp,%r11 + * movl %edi,%ecx + * movl %esi,%eax + * sarq $32,%rsi + * movl %esi,%edx + * wrmsr + * xorl %eax,%eax + * ret + */ ```
(In reply to Nuno Teixeira from comment #51) This cannot build. Comment out only the WRMSR instruction.
(In reply to Konstantin Belousov from comment #52) -ENTRY(wrmsr_early_safe) +// ENTRY(wrmsr_early_safe) movq %rsp,%r11 movl %edi,%ecx movl %esi,%eax build fails with: Building /usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG/modules/usr/src/sys/modules/cc/cc_chd/i386 i386 -> /usr/src/sys/i386/include --- kernel.full --- ld: error: undefined symbol: wrmsr_early_safe >>> referenced by ucode.c:138 (/usr/src/sys/x86/x86/ucode.c:138) >>> ucode.o:(ucode_intel_load) >>> referenced by ucode.c:286 (/usr/src/sys/x86/x86/ucode.c:286) >>> ucode.o:(ucode_amd_load)
(In reply to Nuno Teixeira from comment #53) I can only repeat, this cannot build. Comment out the _INSTRUCTION_, not the symbol.
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 1d7d05843ba8..7a1dcd07e357 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -1571,7 +1571,7 @@ ENTRY(wrmsr_early_safe) movl %esi,%eax sarq $32,%rsi movl %esi,%edx - wrmsr +/* wrmsr */ xorl %eax,%eax ret
(In reply to Konstantin Belousov from comment #55) Crashes at early boot without `exec="staging_slop 134217728"` (main-n286292-c115aad996d5-dirty)
(In reply to Nuno Teixeira from comment #48) Could you confirm, that this picture was taken for default staging_slop (8MB)? In yout trace: staging 0x6dc00000 (not copying) tramp 8x89ed9000 PT4 0x89ea2000 staging address 0x6dc00000 is small and ~500Mb down from tramp and PT4 addresses. It looks like it expanded for every loaded module and reallocated down every time (with big value of staging_slop). Just now I found only 1 place where code can fail in your situation (to crash with default slop and to work with very big value of slop): line in stand/efi/loader/copy.c free memory blocks with parameters that loader did not allocate (in case if blocks were appened or prepended in code before - it is likely your case). BS->FreePages(staging_base, (staging_end - staging_base) / EFI_PAGE_SIZE); UEFI does not document how to behave if second parameter is wrong, some BIOSes does not check correctnes of parameters and can destroy memory content. Quick hack - comment out this line (lost 64 or 128Mb memory) and check together with previous patch, that skip moving of microcode, build only loader (not kernel) and run with default slop. It is for case if the exact place have not found yet, I only looked the code today.
(In reply to Robert William Vesterman from comment #49) the idea was to have starting boot area as small as possible (FreeBSD boots and work on VM with 512MB f.e.). I see from discussion, that the solution for microcode is found, it can be updated in place without additional movements.
(In reply to Vladlen Popolitov from comment #57) That picture was taken with `exec="staging_slop 134217728"` that booted OK. Do you want a new picture without exec staging_slop and with module_verbose="3"?
(In reply to Nuno Teixeira from comment #59) It would be good to have a new picture without exec staging_slop. If you have chance to build loader.efi with commented out line too, it would be good too (my message above).
(In reply to Vladlen Popolitov from comment #60) Applied changes: ```diff diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index d14411d52f10..7716ad11cc3c 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -454,8 +454,10 @@ efi_check_space(vm_offset_t end) */ memcpy((void *)(uintptr_t)new_staging, (void *)(uintptr_t)staging, staging_end - staging); - BS->FreePages(staging_base, (staging_end - staging_base) / - EFI_PAGE_SIZE); + /* + * BS->FreePages(staging_base, (staging_end - staging_base) / + * EFI_PAGE_SIZE); + */ stage_offset -= staging - new_staging; staging = new_staging; staging_end = new_base + nr_pages * EFI_PAGE_SIZE; ``` # mkdir -p /tmp/efi-test # cd /usr/src/stand/efi/loader # make DESTDIR=/tmp/efi-test install # cp /tmp/efi-test/boot/loader.efi /boot/efi/efi/freebsd/loader.efi crashed (code patched without set staging slop): https://people.freebsd.org/~eduardo/boot/boot_patched_crash.jpg clean crashed (code clean without set staging slop): https://people.freebsd.org/~eduardo/boot/boot_clean_crash.jpg
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=16f21c5af35002b8361ffb2e83ff3c92cd899a3a commit 16f21c5af35002b8361ffb2e83ff3c92cd899a3a Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-05-30 15:57:46 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-06-01 16:35:33 +0000 amd64: there is no reason to copy ucode around in ucode_load_bsp() PR: 294630 Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differrential revision: https://reviews.freebsd.org/D57368 sys/x86/x86/ucode.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
(In reply to Nuno Teixeira from comment #48) can you do a memmap command before you boot with module_verbose=3?
(In reply to Warner Losh from comment #63) How do I do that? early boot crashes without set staging slop. Could you give me details how to use memmap?
(In reply to Nuno Teixeira from comment #64) memmap is a loader command, so interrupt the boot, run 'memmap' and then type 'boot'.
(In reply to Warner Losh from comment #65) loading microcode via loader.conf without exec staging_slop main-n286292-c115aad996d5 memmap: https://people.freebsd.org/~eduardo/boot/memmap_1-2.jpg module_verbose + boot + crash: https://people.freebsd.org/~eduardo/boot/mod_verbose_boot_2-2.jpg
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c6ccef4a32b4e09927dfdcc0f734af25c6193f5a commit c6ccef4a32b4e09927dfdcc0f734af25c6193f5a Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-05-30 15:57:46 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-06-04 14:29:19 +0000 amd64: there is no reason to copy ucode around in ucode_load_bsp() PR: 294630 (cherry picked from commit 16f21c5af35002b8361ffb2e83ff3c92cd899a3a) sys/x86/x86/ucode.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
(In reply to commit-hook from comment #67) Is it the same fix for RELENG_14 ?
I think i have a reproducer without ucode. I'll work on it today.
https://reviews.freebsd.org/D57462 should fix it. tl;dr: sometimes we move staging late. The page table we put together to boot the kernel uses a value that's almost, but not always, the final value, causing weird behavior. This is a 15.1R must have, and 14 likely needs it as well, but it's all about things being the right size to tickle it.
A commit in branch releng/15.1 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e27261d80594f32eefb7562989a4836cb81ba262 commit e27261d80594f32eefb7562989a4836cb81ba262 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-05-30 15:57:46 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2026-06-05 22:38:47 +0000 amd64: there is no reason to copy ucode around in ucode_load_bsp() Approved by: re (cperciva) PR: 294630 (cherry picked from commit 16f21c5af35002b8361ffb2e83ff3c92cd899a3a) (cherry picked from commit c6ccef4a32b4e09927dfdcc0f734af25c6193f5a) sys/x86/x86/ucode.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3915ffb1c3e04b26d1506bf35d3f665b2e25a915 commit 3915ffb1c3e04b26d1506bf35d3f665b2e25a915 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2026-06-05 05:18:40 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2026-06-06 01:24:42 +0000 loader.efi: Fix when staging moves late Prior to this commit, we'd compute the page tables and have the last entries point to the staging area. We'd then add some more metadata to the image and boot. This assumed the staging area didn't need to move for this last bit of data. However, if we go over the staging limit, when we copyin new data, we grow the staging area, usually be moving it to a lower address. This overage usually happens when we're loading modules and so things work out nicely. Sometimes we're close to the limit, and we need to do this growing inside bi_load, after we've computed the page table, making the page table wrong, and the code we jump to random rather than the btext routine we normally start at. To fix this, move computation of the table (but not its allocation) to after bi_load, but before we call the trampoline. This problem was most observed when loading microcode for many peole, but Gleb reproduced the error with a set of modules that didn't include ucode. This bug hunt was greatly assisted by Claude who looked at the crash from the EFI boot loader and surmised that we weren't jumping to the code we thought we were jumping to. After inspecting the code, I asked claude how corruption could happen (I thought overwriting the page table), but claude notice the possibility that staging might change after we computed the page table, and this fix is the result. Claude didn't suggest a diff, but did provide many helpful clues that lead me to this fix. PR: 294630 Reviewed by: kib (prior version) Sponsored by: Netflix MFC After: insta per re@ request Differential Revision: https://reviews.freebsd.org/D57462 stand/efi/loader/arch/amd64/elf64_freebsd.c | 51 ++++++++++++++----------- stand/efi/loader/arch/i386/elf64_freebsd.c | 58 +++++++++++++++++------------ stand/efi/loader/bootinfo.c | 18 ++++++++- 3 files changed, 81 insertions(+), 46 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=95632c90ba32a55ec39a14ad7224a21d1c62c096 commit 95632c90ba32a55ec39a14ad7224a21d1c62c096 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2026-06-05 05:18:40 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2026-06-06 01:25:13 +0000 loader.efi: Fix when staging moves late Prior to this commit, we'd compute the page tables and have the last entries point to the staging area. We'd then add some more metadata to the image and boot. This assumed the staging area didn't need to move for this last bit of data. However, if we go over the staging limit, when we copyin new data, we grow the staging area, usually be moving it to a lower address. This overage usually happens when we're loading modules and so things work out nicely. Sometimes we're close to the limit, and we need to do this growing inside bi_load, after we've computed the page table, making the page table wrong, and the code we jump to random rather than the btext routine we normally start at. To fix this, move computation of the table (but not its allocation) to after bi_load, but before we call the trampoline. This problem was most observed when loading microcode for many peole, but Gleb reproduced the error with a set of modules that didn't include ucode. This bug hunt was greatly assisted by Claude who looked at the crash from the EFI boot loader and surmised that we weren't jumping to the code we thought we were jumping to. After inspecting the code, I asked claude how corruption could happen (I thought overwriting the page table), but claude notice the possibility that staging might change after we computed the page table, and this fix is the result. Claude didn't suggest a diff, but did provide many helpful clues that lead me to this fix. PR: 294630 Reviewed by: kib (prior version) Sponsored by: Netflix MFC After: insta per re@ request Differential Revision: https://reviews.freebsd.org/D57462 (cherry picked from commit 3915ffb1c3e04b26d1506bf35d3f665b2e25a915) stand/efi/loader/arch/amd64/elf64_freebsd.c | 51 ++++++++++++++----------- stand/efi/loader/arch/i386/elf64_freebsd.c | 58 +++++++++++++++++------------ stand/efi/loader/bootinfo.c | 18 ++++++++- 3 files changed, 81 insertions(+), 46 deletions(-)
A commit in branch releng/15.1 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=56e59980b673affb82c8c5da9d4338e10d946acd commit 56e59980b673affb82c8c5da9d4338e10d946acd Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2026-06-05 05:18:40 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2026-06-06 02:22:41 +0000 loader.efi: Fix when staging moves late Prior to this commit, we'd compute the page tables and have the last entries point to the staging area. We'd then add some more metadata to the image and boot. This assumed the staging area didn't need to move for this last bit of data. However, if we go over the staging limit, when we copyin new data, we grow the staging area, usually be moving it to a lower address. This overage usually happens when we're loading modules and so things work out nicely. Sometimes we're close to the limit, and we need to do this growing inside bi_load, after we've computed the page table, making the page table wrong, and the code we jump to random rather than the btext routine we normally start at. To fix this, move computation of the table (but not its allocation) to after bi_load, but before we call the trampoline. This problem was most observed when loading microcode for many peole, but Gleb reproduced the error with a set of modules that didn't include ucode. This bug hunt was greatly assisted by Claude who looked at the crash from the EFI boot loader and surmised that we weren't jumping to the code we thought we were jumping to. After inspecting the code, I asked claude how corruption could happen (I thought overwriting the page table), but claude notice the possibility that staging might change after we computed the page table, and this fix is the result. Claude didn't suggest a diff, but did provide many helpful clues that lead me to this fix. Approved by: re (cperciva) PR: 294630 Reviewed by: kib (prior version) Sponsored by: Netflix MFC After: insta per re@ request Differential Revision: https://reviews.freebsd.org/D57462 (cherry picked from commit 3915ffb1c3e04b26d1506bf35d3f665b2e25a915) (cherry picked from commit 95632c90ba32a55ec39a14ad7224a21d1c62c096) stand/efi/loader/arch/amd64/elf64_freebsd.c | 51 ++++++++++++++----------- stand/efi/loader/arch/i386/elf64_freebsd.c | 58 +++++++++++++++++------------ stand/efi/loader/bootinfo.c | 18 ++++++++- 3 files changed, 81 insertions(+), 46 deletions(-)
Am I understanding correctly that (after upgrading to whatever FreeBSD release includes this fix) we should be able to re-enable... cpu_microcode_load="YES" cpu_microcode_name="/boot/firmware/intel-ucode.bin" ... in /boot/loader.conf?
(In reply to Robert William Vesterman from comment #75) Yes. It's my belief you can re-enable ucode.
In other words, please test 15.1-RC3 tomorrow! (I just started the builds.)
(In reply to Colin Percival from comment #77) Let me know if any of the builds failed.
(In reply to Warner Losh from comment #76) Thank you!
(In reply to Nuno Teixeira from comment #66) Could you build loader.efi (loader_lua.efi) from the current 'main' branch and try it without exec staging_slop? Kernel should be patched by previous patch, but it is better to build it from 'main' too, all needed patches have been committed.
(In reply to Warner Losh from comment #70) Hi Warner, I had this hit a few Intel Baytrails based boxes the other week running 14.4 but I had seen it occasionally last Feb which I chalked up to just broken BIOS and changed the units to no uefi boot to work around it. Is the loader.efi exchangeable from RELENG_15 to 14 ? Or are there differences in 14 ?
(In reply to mike from comment #81) Generally we try to keep stable/X and stable/X-1 boot compatible in the boot loader. And this is true of stable/15's loader.efi. You can use it to boot stable/14 (and likely stable/13 and stable/12, though it's been a while since I've tried those). So if you wanted to see if you can boot your stable/14 system by putting this in an ESP (you can name it a weird name and use UEFI shell if you can easily do that and don't want to disturb what's there, or just the normal name), the 15.1-RC3 and newer loader.efi would boot that and if you otherwise couldn't boot it with 14.x, then this changed fixed the problem. There's no danger in performing the experiment, and you can use it as a workaround until I can get this merged to 14. I was going to see how the 15.1-RC3 rollout went before merging it to stable/14. Please report back here if you try it, either way. While the microcode triggered it due to its size, it could be another, lurking bug.
... FreeBSD 16.0-CURRENT #0 main-n286453-4a299ef19c7e: Sat Jun 6 22:50:06 WEST 2026 root@leg:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 FreeBSD clang version 21.1.8 (https://github.com/llvm/llvm-project.git llvmorg-21.1.8-0-g2078da43e25a) VT(efifb): resolution 1920x1080 CPU microcode: updated from 0xf6 to 0x100 CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (2600.00-MHz K8-class CPU) ... Thanks all!
(In reply to Colin Percival from comment #77) I just saw the release notes for 15.1-RC3. Near the top, they say: "When upgrading to 15.1-RC3, please make sure you install the updated EFI boot loader (see below)." This does not seem to have any qualifying information - i.e. you're apparently always supposed to do it, no matter your situation. However, the only thing I see about EFI in any of the rest of the document is specific for the case where you use pkg (as opposed to freebsd-update) to do the update. Do freebsd-update users need to do anything with regards to this, or not? If we do... what? Thanks in advance.
(In reply to Robert William Vesterman from comment #84) > I just saw the release notes for 15.1-RC3. Near the top, they say: > > "When upgrading to 15.1-RC3, please make sure you install the updated EFI boot loader (see below)." I'm not seeing that on: https://www.freebsd.org/releases/15.1R/relnotes/ > Do freebsd-update users need to do anything with regards to this, or not? If we do... what? Yes, this varies, but normally: cp /boot/loader.efi /boot/efi/efi/boot/bootx64.efi and cp /boot/loader.efi /boot/efi/efi/freebsd/{sorry i dont remember what this file is called but this is the other one you need to overwrite}
(In reply to Alexander Ziaee from comment #85) I'm sorry, I guess maybe I shouldn't have said "the release notes". It's from here (which was published one on of the official RSS feeds - I think the "News Flash" one): https://lists.freebsd.org/archives/freebsd-stable/2026-June/004124.html Anyway, thanks. When should it (i.e. copying the boot loader around) be done? Obviously (?) before some reboot, but there are multiple reboots in the instructions: # freebsd-update fetch # freebsd-update install # freebsd-update upgrade -r 15.1-RC3 # freebsd-update install # shutdown -r now # freebsd-update install # shutdown -r now # freebsd-update install
So if you have the old, broken boot loader in your ESP, but the updated one in your boot environment or default root (aka currdev inside the loader), then you can do OK chain /boot/loader.efi to run the new loader, which can then boot the system. You'll then need top do the copies that others have suggested in their comments.
(In reply to Warner Losh from comment #87) Thank you, but I'm not following. "So if you have the old, broken boot loader in your ESP, but the updated one in your boot environment or default root (aka currdev inside the loader), then you can do OK chain /boot/loader.efi to run the new loader, which can then boot the system. You'll then need top do the copies that others have suggested in their comments." I don't know what an ESP is. I don't know when or even whether the updated one will get into my boot environment or default root. I don't know what "currdev inside the loader" is. I don't know what it means to "do OK chain /boot/loader.efi". I don't know a lot of other stuff. I'm sorry for my ignorance, but could someone please give the explicit instructions that I suspect should have been, but were not, included in the instructions that I linked to in my immediately previous comment?
Hi Robert, Sorry about the confusion with the 15.1-RC3 announcement. The text in the pkgbase path about the boot loader applies to the freebsd-update path too: ---- Fourth, update the UEFI boot loader. Back up the existing loader file (if any), then copy the new loader `/boot/loader.efi` to the appropriate location on the EFI System Partition (ESP). Common default destinations: amd64: cp /boot/loader.efi /boot/efi/efi/boot/BOOTX64.EFI aarch64: cp /boot/loader.efi /boot/efi/efi/boot/BOOTAA64.EFI armv7: cp /boot/loader.efi /boot/efi/efi/boot/BOOTARM.EFI If your system uses a non-standard loader path (e.g., `/efi/freebsd/loader.efi`), find the correct destination with `efibootmgr -v` and look for the `File(...)` entry of the active boot option. ---- I'll see about getting it fixed in our template.
(In reply to Robert William Vesterman from comment #88) If you've done a freebsd-update, but haven't followed Colin's suggested update instructions (or accidentally followed them incorrectly) and still have a bad loader.efi, you can use that loader.efi to run the correct one by typing 'chain /boot/loader.efi' at the OK prompt. freebsd-update will update that one automatically, and this is a workaround so you can boot the system to repair it if all else has failed. Hopefully you won't need it if you follow Colin's advice.
Pro tip: To find the loader you booted from: sudo efibootmgr -v | sed -n '/^+/{s/.*\/File(//;s/)$//;p;}' will print it. It should almost always give the same answer as sudo efivar --utf8 `sudo efivar | grep LoaderPath` which displays the breadcrumb the current loader left you to tell you where you booted from.
OK, thanks everyone. I decided to copy the loader.efi file around immediately before the first reboot (i.e. after freebsd-update fetch, install, upgrade, and a second install). Rebooting worked, and after the third "freebsd-update install" (i.e. the first post-reboot one), "freebsd-version -kru" shows 15.1-RC3 for everything. However, note that my machine *had* been (before starting the upgrade to 15.1-RC3) in a state which it could reboot in, which I had accomplished by disabling these lines in /boot/loader.conf: =============================== cpu_microcode_load="YES" cpu_microcode_name="/boot/firmware/intel-ucode.bin" =============================== I intentionally did not reenable them yet; I wanted to first make sure the machine was still rebooting after 15.1-RC3 was installed. So, this is not necessarily confirmation that everything has worked. I intend to reenable them soon, but first (as suggested) I will be rebuilding my ports. That will take hours and hours. I will be going to bed well before I expect it to finish. So, I'll post another update here later (likely tomorrow).
(In reply to commit-hook from comment #74) It fixes my boot problem, thanks a lot!
15.1-RC3 has addressed this for me too, removing the exec slop loader tunable.
Welp, rebuilding my ports only took 21 hours :P I'm happy to say that this all seems to be working fine with 15.1 RC3, including with having reenabled the cpu_microcode_* stuff in /boot/loader.conf. Thanks again, everyone!
(In reply to Warner Losh from comment #82) Good news is my RELENG_14 box boots with the loader.efi from RELENG_15 as expected. Bad news is, of the units we got back in from the field, its not easy to trigger this bug once I have worked around it either by booting legacy or putting in slop values a few times. I have over 150 of these guys in the field, and only a half dozen would not come back after I did FreeBSD updates in the field. Of the initial 6 that were impacted, 2 came back after a couple of power cycles, 4 did not. Of the 3 that I got returned to me, I am not able to recreate the situation on demand now. First thing I did was force the box to boot via legacy and that worked. Then back to UEFI and still the problem. Put in some slop values and it works. Remove the slop values... and it still works. I have one more of the effected units to arrive tomorrow, so I will see if I can recreate the issue and work around it by copying the fixed loader.efi onto the image without doing any other changes.
(In reply to mike from comment #96) That's enough for me to MFC to 14.
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=8dca7fccfa6514b0a48a290683572fadbb4e2a68 commit 8dca7fccfa6514b0a48a290683572fadbb4e2a68 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2026-06-05 05:18:40 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2026-06-08 16:34:58 +0000 loader.efi: Fix when staging moves late Prior to this commit, we'd compute the page tables and have the last entries point to the staging area. We'd then add some more metadata to the image and boot. This assumed the staging area didn't need to move for this last bit of data. However, if we go over the staging limit, when we copyin new data, we grow the staging area, usually be moving it to a lower address. This overage usually happens when we're loading modules and so things work out nicely. Sometimes we're close to the limit, and we need to do this growing inside bi_load, after we've computed the page table, making the page table wrong, and the code we jump to random rather than the btext routine we normally start at. To fix this, move computation of the table (but not its allocation) to after bi_load, but before we call the trampoline. This problem was most observed when loading microcode for many peole, but Gleb reproduced the error with a set of modules that didn't include ucode. This bug hunt was greatly assisted by Claude who looked at the crash from the EFI boot loader and surmised that we weren't jumping to the code we thought we were jumping to. After inspecting the code, I asked claude how corruption could happen (I thought overwriting the page table), but claude notice the possibility that staging might change after we computed the page table, and this fix is the result. Claude didn't suggest a diff, but did provide many helpful clues that lead me to this fix. PR: 294630 Reviewed by: kib (prior version) Sponsored by: Netflix MFC After: insta per re@ request Differential Revision: https://reviews.freebsd.org/D57462 (cherry picked from commit 3915ffb1c3e04b26d1506bf35d3f665b2e25a915) stand/efi/loader/arch/amd64/elf64_freebsd.c | 47 ++++++++++++++++++----------- stand/efi/loader/bootinfo.c | 19 +++++++++++- 2 files changed, 48 insertions(+), 18 deletions(-)
(In reply to Warner Losh from comment #97) Just to close the loop a bit, I confirmed with a box I got back today that had this problem. Baytrail J1900 chipset was running 14.4p5. Installing the new loader.efi allows it to boot without issue.
Thanks to imp@ for fixing the issue and to everyone who provided feedback. If there are still problems people report them here and I will reopen the bug.
I'd suggest if there's still similar issues, those get a new bug rather than reopening this.