• Jinyang He's avatar
    MIPS: Loongson64: Add KASLR support · a307a4ce
    Jinyang He authored
    Provide a weak plat_get_fdt() in relocate.c in case some platform enable
    USE_OF while plat_get_fdt() is useless.
    
    1MB RELOCATION_TABLE_SIZE is small for Loongson64 because too many
    instructions should be relocated. 2MB is enough in present.
    
    Add KASLR support for Loongson64.
    
    KASLR(kernel address space layout randomization)
    
    To enable KASLR on Loongson64:
    First, make loongson3_defconfig.
    Then, enable CONFIG_RELOCATABLE and CONFIG_RANDOMIZE_BASE.
    Finally, compile the kernel.
    
    To test KASLR on Loongson64:
    Start machine with KASLR kernel.
    
    The first time:
    # cat /proc/iomem
    00200000-0effffff : System RAM
      02f30000-03895e9f : Kernel code
      03895ea0-03bc7fff : Kernel data
      03e30000-04f43f7f : Kernel bss
    
    The second time:
    # cat /proc/iomem
    00200000-0effffff : System RAM
      022f0000-02c55e9f : Kernel code
      02c55ea0-02f87fff : Kernel data
      031f0000-04303f7f : Kernel bss
    
    We see that code, data and bss sections become randomize.
    Signed-off-by: default avatarJinyang He <hejinyang@loongson.cn>
    Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
    a307a4ce
Kconfig 85.4 KB