riscv: Add STACKPROTECTOR supported
authorGuo Ren <guoren@linux.alibaba.com>
Fri, 10 Jul 2020 16:19:57 +0000 (16:19 +0000)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Thu, 30 Jul 2020 18:37:39 +0000 (11:37 -0700)
commitf2c9699f65557a31fed4ddb9e5b4d9489b1bf32f
tree944424af9ffbfbb6ac6dafef33202045a2e8da4c
parent08b5985e7be54d15d058191adda2722bd395df32
riscv: Add STACKPROTECTOR supported

The -fstack-protector & -fstack-protector-strong features are from
gcc. The patch only add basic kernel support to stack-protector
feature and some arch could have its own solution such as
ARM64_PTR_AUTH.

After enabling STACKPROTECTOR and STACKPROTECTOR_STRONG, the .text
size is expanded from  0x7de066 to 0x81fb32 (only 5%) to add canary
checking code.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/Kconfig
arch/riscv/include/asm/stackprotector.h [new file with mode: 0644]
arch/riscv/kernel/process.c