bugGNU GRUB - Bugs: bug #23615, EFI memory map size

 
 

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

bug #23615: EFI memory map size

Submitter:  David Holloway <gwythaint>
Submitted:  Tue 17 Jun 2008 08:57:54 AM UTC
   
 
Category:  Booting Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  Bazaar - trunk
Release:  kern/efi/mm.c version 1.4 Reproducibility:  Every Time
Planned Release:  None

Jump to the original submission

Sun 17 Oct 2010 05:57:28 PM UTC, comment #11: 

Yes, the latest bazaar version (your patch applied and MEMORY_MAP_SIZE to 0x3000) works out of the box on my Dell E6510.

Thank you.

Frederik Kriewitz <freddy436>
Sun 17 Oct 2010 05:54:35 PM UTC, comment #10: 

Yes, the latest bazaar version (your patch applied and MEMORY_MAP_SIZE to 0x3000) works out of the box on my Dell E6510.

Thank you.

Frederik Kriewitz <freddy436>
Sat 16 Oct 2010 08:42:40 PM UTC, comment #9: 

This patch is applied now. It tested and it works on qemu artificially triggering this code branch. Can anybody test it?

Vladimir Serbinenko <phcoder>
Group administrator
Tue 05 Oct 2010 09:03:33 AM UTC, comment #8: 

Please try the attached patch

(file #21619)

Vladimir Serbinenko <phcoder>
Group administrator
Wed 08 Sep 2010 07:31:48 AM UTC, comment #7: 

#define BYTES_TO_PAGES(bytes) ((bytes + 0xfff) >> 12)
doesn't change anything.
I still have to set MEMORY_MAP_SIZE to 0x5000

Frederik Kriewitz <freddy436>
Sun 05 Sep 2010 10:19:26 PM UTC, comment #6: 

Could you try this?
=== modified file 'grub-core/kern/efi/mm.c'
--- grub-core/kern/efi/mm.c 2010-08-25 01:25:18 +0000
+++ grub-core/kern/efi/mm.c 2010-09-05 22:18:53 +0000
@@ -25,7 +25,7 @@
 #define NEXT_MEMORY_DESCRIPTOR(desc, size) \
   ((grub_efi_memory_descriptor_t ) ((char ) (desc) + (size)))
 
-#define BYTES_TO_PAGES(bytes) ((bytes) >> 12)
+#define BYTES_TO_PAGES(bytes) ((bytes + 0xfff) >> 12)
 #define PAGES_TO_BYTES(pages) ((pages) << 12)
 
 /* The size of a memory map obtained from the firmware. This must be


Vladimir Serbinenko <phcoder>
Group administrator
Sun 05 Sep 2010 09:39:45 PM UTC, comment #5: 

I hava the same problem on a Dell E6510 notebook.
After increasing MEMORY_MAP_SIZE to 0x5000 (It asks for 0x44a0), it's working:

=== modified file 'grub-core/kern/efi/mm.c'
--- grub-core/kern/efi/mm.c 2010-08-25 01:25:18 +0000
+++ grub-core/kern/efi/mm.c 2010-09-05 21:37:46 +0000
@@ -30,7 +30,7 @@
 
 /* The size of a memory map obtained from the firmware. This must be
    a multiplier of 4KB.  */
-#define MEMORY_MAP_SIZE 0x3000
+#define MEMORY_MAP_SIZE 0x5000
 
 /* Maintain the list of allocated pages.  */
 struct allocated_page


Frederik Kriewitz <freddy436>
Sun 05 Sep 2010 07:44:04 PM UTC, comment #4: 

According to the code it was fixed a long time ago. If it persists feel free to reopen.

Vladimir Serbinenko <phcoder>
Group administrator
Fri 22 Aug 2008 09:51:43 PM UTC, comment #3: 


>Shouldn't this handled in a way to first query size of the needed >memory from EFI and then allocate that memory and then make a new >call to take everything and not not play with macros.


Yes, that's might thought too.

David Holloway <gwythaint>
Fri 22 Aug 2008 09:42:36 PM UTC, comment #2: 

Shouldn't this handled in a way to first query size of the needed memory from EFI and then allocate that memory and then make a new call to take everything and not not play with macros.

Vesa Jääskeläinen <chaac>
Group Member
Thu 21 Aug 2008 08:49:53 PM UTC, comment #1: 

In current SVN there's now even
#define MEMORY_MAP_SIZE 0x3000

As far as I could see the second change you proposed hasn't been applied.

By the way please use `diff -u' i.e. unified diff format it's easier to read.

Felix Zielcke <fzielcke>
Group Member
Tue 17 Jun 2008 08:57:54 AM UTC, original submission:  

grub_efi_get_memory_map() has two failure modes and one, GRUB_EFI_BUFFER_TOO_SMALL is not handled gracefully.

The the problem occurs if a native EFI firmware requires more than MEMORY_MAP_SIZE; 4096 bytes in this case.

By happenstance, the problem is mis-reported as "too little memory"  when in fact, the memory map itself is not processor properly.

It probably takes a seriously large server board such as the Intel NSW1U Network Server to report such a large memory map table.

As an example, the NSW1U, American Megatrends bios version S5000.86B.10.00.0085 requires 7872 bytes.


The following is a workaround for this class of symptom and a differential diagnostic message for the errors possible from grub_efi_get_memory_map().

Index: mm.c
===================================================================
RCS file: /sources/grub/grub2/kern/efi/mm.c,v
retrieving revision 1.4
diff -r1.4 mm.c
33c33
< #define MEMORY_MAP_SIZE       0x1000
---

> #define MEMORY_MAP_SIZE       0x2000

346a347

>   int efi_status;

367c368,373
<   if (grub_efi_get_memory_map (&map_size, memory_map, 0, &desc_size, 0) < 0)
---

>   efi_status = grub_efi_get_memory_map (&map_size, memory_map, 0, &desc_size, 0);
>
>   if (efi_status == 0)
>     grub_fatal ("buffer too small: need %d bytes", map_size);
>
>   if (efi_status == -1)


David Holloway <gwythaint>

 

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

Attached Files
file #21619:  bigefimmap.diff added by phcoder (3KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by freddy436 (Posted a comment)
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by freddy436
  • -email is unavailable- added by chaac (Posted a comment)
  • -email is unavailable- added by fzielcke (Posted a comment)
  • -email is unavailable- added by gwythaint (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.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-10-17 phcoder Open/ClosedOpen Closed
    2010-10-05 phcoder Attached File- Added bigefimmap.diff, #21619
        Open/ClosedClosed Open
    2010-09-05 phcoder StatusNone Fixed
        Open/ClosedOpen Closed
        ReleaseNone Bazaar - trunk
    2010-08-12 freddy436 Carbon-Copy- Added freddy436

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code