[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1673255274-18238-1-git-send-email-tangyouling@loongson.cn>
Date: Mon, 9 Jan 2023 17:07:50 +0800
From: Youling Tang <tangyouling@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>,
Xi Ruoyao <xry111@...111.site>,
Jinyang He <hejinyang@...ngson.cn>
Cc: Xuerui Wang <kernel@...0n.name>, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH 0/4] LoongArch: Add kernel relocation and KASLR support
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
Powered by blists - more mailing lists