Page 1 of 1
GRUB page fault when using UEFI?
Posted: Thu Jul 23, 2026 1:00 pm
by melodyrs
I've spent a few days now trying to understand why I'm getting a page fault when GRUB is booted with UEFI but not with BIOS.
Everything works up until
https://gitlab.freedesktop.org/gnu-grub ... ain=1#L112 where GRUB jumps to a memory address some thousand bytes away from where the entry point is loaded. I think GRUB loads some code at that address which is supposed to do some relocations?
At this point, I'm not sure if this a GRUB issue or an issue with my code? I've attached a basic reproduction that has the same bug.
works but
page faults
(I originally had this posted in General Programming but realized that's the wrong board)
Re: GRUB page fault when using UEFI?
Posted: Sat Jul 25, 2026 7:48 pm
by Octocontrabass
melodyrs wrote: ↑Thu Jul 23, 2026 1:00 pmAt this point, I'm not sure if this a GRUB issue or an issue with my code?
Which versions of GRUB and OVMF are you using?
melodyrs wrote: ↑Thu Jul 23, 2026 1:00 pmI've attached
No you haven't.
Re: GRUB page fault when using UEFI?
Posted: Sat Jul 25, 2026 10:20 pm
by melodyrs
No you haven't.
Sorry, thought I did.
Which versions of GRUB and OVMF are you using?
I'm using GRUB 2:2.14-1 and OVMF 202605-1.
Re: GRUB page fault when using UEFI?
Posted: Sun Jul 26, 2026 8:14 pm
by ashy5000
Hi,
I ran into this issue a while back. If I remember correctly, it was caused by an attempt to write to a page that was not writeable, and that was outside the memory of the kernel (which was loaded into memory correctly). I found a patch to GRUB that solved this issue, but I'm not sure if it is actually a bug in GRUB or just an issue in how I was configuring it. The explanation given by the patch author seems reasonable, but, again, I haven't looked very deep into the issue, so it's quite possible the patch isn't needed, especially given that it hasn't been included in the latest versions of GRUB. I'll attach it if you want to try it out:
Re: GRUB page fault when using UEFI?
Posted: Mon Jul 27, 2026 9:43 am
by Octocontrabass
An updated version of that patch will be included in the next version of GRUB.
In the meantime, you can either build a version of GRUB that includes the above commit or revert to a version prior to
the commit that introduced the bug such as 2.12.
Re: GRUB page fault when using UEFI?
Posted: Mon Jul 27, 2026 3:28 pm
by melodyrs
An updated version of that patch will be included in the next version of GRUB.
I was doing my debugging with GRUB commit 94a457f and was getting boot loops (I presumed from a page fault and grub's debug build installing an interrupt to catch that). Maybe there's something else going on...?