1. 27 Nov, 2020 2 commits
    • 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
    • Jinyang He's avatar
      MIPS: KASLR: Correct valid bits in apply_r_mips_26_rel() · 74a2810b
      Jinyang He authored
      Apply_r_mips_26_rel() relocates instructions like j, jal and etc. These
      instructions consist of 6bits function field and 26bits address field.
      The value of target_addr as follows,
      =================================================================
      |     high 4bits           |            low 28bits              |
      =================================================================
      |the high 4bits of this PC | the low 26bits of instructions << 2|
      =================================================================
      Thus, loc_orig and log_new both need high 4bits rather than high 6bits.
      Signed-off-by: default avatarJinyang He <hejinyang@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      74a2810b
  2. 19 Nov, 2020 6 commits
  3. 17 Nov, 2020 14 commits
  4. 12 Nov, 2020 16 commits
  5. 11 Nov, 2020 2 commits