bugGNU GRUB - Bugs: bug #61058, out of memory error on HP 250 G7...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #61058: out of memory error on HP 250 G7 and HP 450 G8 laptop loading large initrd (500Mb)

Submitter:  Patrick Das <intoto>
Submitted:  Wed 18 Aug 2021 10:11:29 PM UTC
   
 
Category:  Booting Severity:  Major
Priority:  5 - Normal Item Group:  Hardware-specific
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release:  other
Release:  Reproducibility:  Every Time
Planned Release:  None

Wed 14 Dec 2022 11:25:25 AM UTC, comment #4: 

I confirmed that jak mentioned, by getting grub2 (2.06-2ubuntu16) from ubuntu-lunar-proposed and it can boot up to 453M on a real machine.

In the meantime, I proposed a patch https://www.mail-archive.com/grub-devel@gnu.org/msg35526.html which hope can be consider as a short fix before integrating the pieces of MM/grub_open/verifier.

Likely archboot will fail to boot in the latest tree.

Jeremy Szu <jeremyszu>
Fri 09 Dec 2022 05:00:51 PM UTC, comment #3: 

After applying the 2.12 memory management changes I was able to load files up to 1.1GB in a qemu. I could not fit larger initrds on the /boot.

This of course doesn't solve the problem entirely - 4GB is still the memory map limit on x86 due to concerns of DMA failures when DMAing to >4GB areas.

To allow larger files like 4GB initrds, what we need to do is quite clearly fix grub_verifiers_open() to not allocate the entire file using grub_malloc(), but allocate the file memory directly from EFI[1], then allocate a small bounce buffer in our grub_malloc region and copy from disk to bounce buffer to real buffer (this prevents 64-bit DMA issues)

[1] So either we need a grub_malloc_large() or something or maybe we just make grub_malloc() pass huge allocations directly to EFI. I don't think other places really need to allocate giant memory blocks, so this should still be safe wrt dma if we say "any allocations over 10 pages is directly allocated from UEFI" or something.

Julian Andres Klode <jak>
Fri 15 Jul 2022 06:30:27 AM UTC, comment #2: 

comment #1:

> The same issue here.
>
> The issue is not highly related to initramfs but more likely grub memory management.
>
> If the higher memory usage (e.g. GFXMODE=3840x2560) then grub will not able to read 100MB file somethings but if I set GFXMODE=640x480, then the file ups to 200MB can be recognized.
>
> I tried to "ls -al a-100MB-file" and "ls -al a-200MB-file" and easy to reproduce this issue with different GFXMODE.
>
> Here is a launchpad discussion.


My issue is gone after applying this MP
https://github.com/rhboot/grub2/pull/102

Jeremy Szu <jeremyszu>
Wed 01 Jun 2022 06:59:12 AM UTC, comment #1: 

The same issue here.

The issue is not highly related to initramfs but more likely grub memory management.

If the higher memory usage (e.g. GFXMODE=3840x2560) then grub will not able to read 100MB file somethings but if I set GFXMODE=640x480, then the file ups to 200MB can be recognized.

I tried to "ls -al a-100MB-file" and "ls -al a-200MB-file" and easy to reproduce this issue with different GFXMODE.

Here is a launchpad discussion.

Jeremy Szu <jeremyszu>
Wed 18 Aug 2021 10:11:29 PM UTC, original submission:  

Grub fails with out of memory error (../../grub-core/kern/mm.c:374:out of memory.) when loading a large initrd image on a HP 250 G7 notebook. The initrd image is around 500Mb (506.139.888 bytes).

The error happens on HP 250 G7 and HP Probook 450 G8 based laptops, both having a UEFI bios.

Grub version 2.04 and 2.06 have been tested.

The kernel and initrd are a custom build based on Fedora Core 34. (Kernel 5.12.8-300.fc34.x86_64)


This configuration is booted from a USB stick with a FAT partition.

On a lot of other computers this USB stick configuration is working fine, we tested it in a virtual machine (Hyper-V) but also on for example a older model HP 250 G6 and all kinds of other brands of computers and laptops.

On my testmachine a HP 250 G7 with intel core i3-1005g1 cpu and 8Gb of memory, lates bios F.36. I've made a recording of the boot process of grub2 with set debug=all. See image under the attachment for details.

It seems that the allocation of the memory goes wrong based on the output on the screen trying to allocate 123570 pages from address 0xffffffffffffffff.

This error is reproducable on this computer and other models like the HP Probook 450 G8.

A little bit of background:

We use this image as a secure examination environment on a lot of different computers in the Netherlands and so far this setup has been working for the last 4 years on all kinds of hardware.

please let me know if more details our debug info is needed.

Patrick Das <intoto>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #51799:  grub-debug-bsb-boot@(2).jpg added by intoto (725KiB - image/jpeg)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jak (Posted a comment)
  • -email is unavailable- added by jeremyszu (Posted a comment)
  • -email is unavailable- added by intoto (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-18 intoto Attached File- Added grub-debug-bsb-boot@(2).jpg, #51799

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code