]> www.infradead.org Git - users/jedix/linux-maple.git/commit
LoongArch: Add RANDOMIZE_KSTACK_OFFSET support
authorJinjie Ruan <ruanjinjie@huawei.com>
Sat, 20 Jul 2024 14:40:58 +0000 (22:40 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sat, 20 Jul 2024 14:40:58 +0000 (22:40 +0800)
commita0f7085f6a63f19f83f2644ce2da49a8d3cf7c0f
tree646a6b07f4a6de409ee4b11bb129f8d84ccd3197
parent08f417db702c5b05150b3851af7186fee96ddd46
LoongArch: Add RANDOMIZE_KSTACK_OFFSET support

Add support of kernel stack offset randomization while handling syscall,
the offset is defaultly limited by KSTACK_OFFSET_MAX().

In order to avoid triggering stack canaries (due to __builtin_alloca())
and slowing down the entry path, use __no_stack_protector attribute to
disable stack protector for do_syscall() at function level.

With this patch, the REPORT_STACK test show that:

`loongarch64 bits of stack entropy: 7`

Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/Kconfig
arch/loongarch/kernel/syscall.c