summaryrefslogtreecommitdiffstats
path: root/arch/loongarch/kernel/process.c
diff options
context:
space:
mode:
authorHuacai Chen <chenhuacai@loongson.cn>2022-12-10 22:40:15 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2022-12-14 08:41:53 +0800
commit09f33601bf940f955c10a6e75a1c1b7bcadee5e2 (patch)
tree423542be6f130680ebf31b6f679af26cb764775a /arch/loongarch/kernel/process.c
parent7db54bfe44a662c8f2c10277bccfa02c2f4c719c (diff)
downloadlinux-stable-09f33601bf940f955c10a6e75a1c1b7bcadee5e2.tar.gz
linux-stable-09f33601bf940f955c10a6e75a1c1b7bcadee5e2.tar.bz2
linux-stable-09f33601bf940f955c10a6e75a1c1b7bcadee5e2.zip
LoongArch: Add basic STACKPROTECTOR support
Add basic stack protector support similar to other architectures. A constant canary value is set at boot time, and with help of compiler's -fstack-protector we can detect stack corruption. Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kernel/process.c')
-rw-r--r--arch/loongarch/kernel/process.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/loongarch/kernel/process.c b/arch/loongarch/kernel/process.c
index ddb8ba4eb399..790cc14c5f06 100644
--- a/arch/loongarch/kernel/process.c
+++ b/arch/loongarch/kernel/process.c
@@ -47,6 +47,12 @@
#include <asm/unwind.h>
#include <asm/vdso.h>
+#ifdef CONFIG_STACKPROTECTOR
+#include <linux/stackprotector.h>
+unsigned long __stack_chk_guard __read_mostly;
+EXPORT_SYMBOL(__stack_chk_guard);
+#endif
+
/*
* Idle related variables and functions
*/