lkml.org 
[lkml]   [2023]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Subject[PATCH 0/4] LoongArch: Add kernel relocation and KASLR support
    Date
    This patch series to support kernel relocation and KASLR (only 64bit).

    Both old[1] and new[2] toolchains support this feature, and the test results
    are as follows:
    1) Enable CONFING_RELOCATABLE
    # cat /proc/iomem
    00000000-0fffffff : System RAM
    00000000-002c3fff : Reserved
    002c4000-008c3fff : Reserved
    02000000-02f4ffff : Kernel code
    02f50000-0381cbff : Kernel data
    0381cc00-0394ae37 : Kernel bss

    2) Enable CONFING_RANDOMIZE_BASE (KASLR)
    first:
    # cat /proc/iomem
    00000000-0fffffff : System RAM
    00000000-002c3fff : Reserved
    002c4000-008c3fff : Reserved
    02550000-0349ffff : Kernel code
    034a0000-03d6cbff : Kernel data
    03d6cc00-03e9ae37 : Kernel bss

    second:
    # cat /proc/iomem
    00000000-0fffffff : System RAM
    00000000-002c3fff : Reserved
    002c4000-008c3fff : Reserved
    02ad0000-03a1ffff : Kernel code
    03a20000-042ecbff : Kernel data
    042ecc00-0441ae37 : Kernel bss

    Thanks to @Ruoyao's and @Jinyang's for their help and suggestions.

    Links:
    [1]: https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/download/5.0/loongarch64-clfs-5.1-cross-tools-c-only.tar.xz
    [2]: https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/download/6.0/loongarch64-clfs-6.3-cross-tools-c-only.tar.xz

    Xi Ruoyao (1):
    LoongArch: Use trampoline for exception handlers and kill la.abs

    Youling Tang (3):
    LoongArch: Add JUMP_LINK_ADDR macro implementation to avoid using
    la.abs
    LoongArch: Add support for kernel relocation
    LoongArch: Add support for kernel address space layout randomization
    (KASLR)

    arch/loongarch/Kconfig | 37 +++++
    arch/loongarch/Makefile | 5 +
    arch/loongarch/include/asm/page.h | 6 +
    arch/loongarch/include/asm/stackframe.h | 16 +-
    arch/loongarch/include/asm/uaccess.h | 1 -
    arch/loongarch/kernel/Makefile | 2 +
    arch/loongarch/kernel/entry.S | 6 +-
    arch/loongarch/kernel/genex.S | 20 +--
    arch/loongarch/kernel/head.S | 30 +++-
    arch/loongarch/kernel/relocate.c | 210 ++++++++++++++++++++++++
    arch/loongarch/kernel/setup.c | 3 +
    arch/loongarch/kernel/traps.c | 4 +-
    arch/loongarch/kernel/vmlinux.lds.S | 11 +-
    arch/loongarch/mm/tlbex.S | 28 +---
    arch/loongarch/power/suspend_asm.S | 5 +-
    15 files changed, 333 insertions(+), 51 deletions(-)
    create mode 100644 arch/loongarch/kernel/relocate.c

    --
    2.37.1

    \
     
     \ /
      Last update: 2023-03-26 23:32    [W:3.663 / U:0.532 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site