public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] LoongArch: Add kernel relocation and KASLR support
@ 2023-01-09  9:07 Youling Tang
  2023-01-09  9:07 ` [PATCH 1/4] LoongArch: Use trampoline for exception handlers and kill la.abs Youling Tang
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Youling Tang @ 2023-01-09  9:07 UTC (permalink / raw)
  To: Huacai Chen, Xi Ruoyao, Jinyang He; +Cc: Xuerui Wang, loongarch, linux-kernel

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


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-01-17  1:38 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-09  9:07 [PATCH 0/4] LoongArch: Add kernel relocation and KASLR support Youling Tang
2023-01-09  9:07 ` [PATCH 1/4] LoongArch: Use trampoline for exception handlers and kill la.abs Youling Tang
2023-01-14  6:38   ` Jinyang He
2023-01-16  1:30     ` Huacai Chen
2023-01-16  5:41       ` Xi Ruoyao
2023-01-17  1:38         ` Huacai Chen
2023-01-09  9:07 ` [PATCH 2/4] LoongArch: Add JUMP_LINK_ADDR macro implementation to avoid using la.abs Youling Tang
2023-01-14  6:40   ` Jinyang He
2023-01-14  7:25     ` Youling Tang
2023-01-14  7:30       ` Huacai Chen
2023-01-09  9:07 ` [PATCH 3/4] LoongArch: Add support for kernel relocation Youling Tang
2023-01-09 21:52   ` kernel test robot
2023-01-11  3:18   ` Youling Tang
2023-01-14  6:54   ` Jinyang He
2023-01-14  7:50     ` Youling Tang
2023-01-14  8:30       ` Jinyang He
2023-01-14  8:56         ` Youling Tang
2023-01-09  9:07 ` [PATCH 4/4] LoongArch: Add support for kernel address space layout randomization (KASLR) Youling Tang
2023-01-11  5:02   ` kernel test robot
2023-01-13  6:44 ` [PATCH 0/4] LoongArch: Add kernel relocation and KASLR support Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox