bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #39488] multiboot2 failed to load 64-bit ELF image


From: Leon Drugi
Subject: [bug #39488] multiboot2 failed to load 64-bit ELF image
Date: Mon, 15 Jul 2013 09:52:51 +0000
User-agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?39488>

                 Summary: multiboot2 failed to load 64-bit ELF image
                 Project: GNU GRUB
            Submitted by: eyak
            Submitted on: Mon 15 Jul 2013 09:52:50 AM GMT
                Category: Booting
                Severity: Major
                Priority: 5 - Normal
              Item Group: Software Error
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 
                 Release: Bazaar - trunk
         Reproducibility: Every Time
         Planned Release: None

    _______________________________________________________

Details:

Hello,

I use 64-bit GRUB2 under x86_64 EFI and would like to load an 64-bit ELF
images, but unfortunatelly 'invalid entry point for ELF64' message appears. To
fix this issue in file multiboot_elfxx.c file the lines (in function
grub_multiboot_load_elf()):

#ifdef MULTIBOOT_LOAD_ELF64
# if defined(__mips)
  /* We still in 32-bit mode.  */
  if (ehdr->e_entry < 0xffffffff80000000ULL)
    return grub_error (GRUB_ERR_BAD_OS, "invalid entry point for ELF64");

should be replaced with:

#ifdef MULTIBOOT_LOAD_ELF64
# if defined(__mips) || defined(__x86_64)
  /* We still in 32-bit mode.  */
  if (ehdr->e_entry < 0xffffffff80000000ULL)
    return grub_error (GRUB_ERR_BAD_OS, "invalid entry point for ELF64");

Additionally under loaded 64-bit ELF image both virtual and physical addresses
are encoded in canonical form address. 

$ objdump -h Image 

Image:     file format elf64-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off 
Algn
  0 .text         001e0cd0  ffffffff80608000  ffffffff80608000  00000080 
2**5
                  CONTENTS, ALLOC, LOAD, CODE
  1 .build_vars 00000150  ffffffff807e8cd0  ffffffff807e8cd0  001e0d50  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .data         000498d0  ffffffff807e8e40  ffffffff807e8e40  001e0ec0 
2**6
                  CONTENTS, ALLOC, LOAD, DATA
  3 .bss          0101b9e0  ffffffff80832720  ffffffff80832720  0022a790 
2**5
                  ALLOC
  4 .debug_aranges 00000cf0  0000000000000000  0000000000000000  0022a790 
2**0
                  CONTENTS, READONLY, DEBUGGING
  5 .debug_pubnames 00000d5c  0000000000000000  0000000000000000  0022b480 
2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_info   0000f50e  0000000000000000  0000000000000000  0022c1dc 
2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_abbrev 000041b7  0000000000000000  0000000000000000  0023b6ea 
2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_line   000048a0  0000000000000000  0000000000000000  0023f8a1 
2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_frame  00001948  0000000000000000  0000000000000000  00244148 
2**3
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_str    00002c63  0000000000000000  0000000000000000  00245a90 
2**0
                  CONTENTS, READONLY, DEBUGGING
 11 .debug_loc    00013290  0000000000000000  0000000000000000  002486f3 
2**0
                  CONTENTS, READONLY, DEBUGGING
 12 .debug_ranges 00002980  0000000000000000  0000000000000000  0025b983 
2**0
                  CONTENTS, READONLY, DEBUGGING

So the address should be cutted to 32-bit address space. It might be done with
adding the code encapsulated with ifdefs also in grub_multiboot_load_elf
function:

      if (phdr(i)->p_type == PT_LOAD)
        {
          grub_err_t err;
          void *source;
#ifdef MULTIBOOT_LOAD_ELF64
#ifdef (__x86_64)
          phdr(i)->p_paddr &=0x7fffffff;
#endif /* defined(__x86_64) */
#endif /* MULTIBOOT_LOAD_ELF64 */

Is it possible to apply these changes for GRUB2 please. It would be very
helpfully for x86_64 targets.
Thanks.

Best Regards
Leon





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39488>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]