• Alexander Gordeev's avatar
    s390: Relocate vmlinux ELF data to virtual address space · 9ecaa2e9
    Alexander Gordeev authored
    
    
    Currently kernel image relocation tables and other ELF
    data are set to base zero. Since kernel virtual and
    physical address spaces are uncoupled the kernel is
    mapped at the top of the virtual address space, hence
    making the information contained in vmlinux ELF tables
    inconsistent.
    
    That does not pose any issue with regard to the kernel
    booting and operation, but makes it difficult to use a
    generated vmlinux with some debugging tools (e.g. gdb).
    
    Relocate vmlinux image base address from zero to a base
    address in the virtual address space. It is the address
    that kernel is mapped to in cases KASLR is disabled.
    
    The vmlinux ELF header before and after this change looks
    like this:
    
    Elf file type is EXEC (Executable file)
    Entry point 0x100000
    There are 3 program headers, starting at offset 64
    
    Program Headers:
      Type           Offset             VirtAddr           PhysAddr
                     FileSiz            MemSiz              Flags  Align
      LOAD           0x0000000000001000 0x0000000000100000 0x0000000000100000
                     0x0000000001323378 0x0000000001323378  R E    0x1000
      LOAD           0x0000000001325000 0x0000000001424000 0x0000000001424000
                     0x00000000003a4200 0x000000000048fdb8  RWE    0x1000
      NOTE           0x00000000012a33b0 0x00000000013a23b0 0x00000000013a23b0
                     0x0000000000000054 0x0000000000000054         0x4
    
    Elf file type is EXEC (Executable file)
    Entry point 0x3ffe0000000
    There are 3 program headers, starting at offset 64
    
    Program Headers:
      Type           Offset             VirtAddr           PhysAddr
                     FileSiz            MemSiz              Flags  Align
      LOAD           0x0000000000001000 0x000003ffe0000000 0x000003ffe0000000
                     0x0000000001323378 0x0000000001323378  R E    0x1000
      LOAD           0x0000000001325000 0x000003ffe1324000 0x000003ffe1324000
                     0x00000000003a4200 0x000000000048fdb8  RWE    0x1000
      NOTE           0x00000000012a33b0 0x000003ffe12a23b0 0x000003ffe12a23b0
                     0x0000000000000054 0x0000000000000054         0x4
    Suggested-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
    Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
    9ecaa2e9
page.h 6.9 KB