hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/arch/arm/include/asm/stackprotector.h
....@@ -6,8 +6,10 @@
66 * the stack frame and verifying that it hasn't been overwritten when
77 * returning from the function. The pattern is called stack canary
88 * and gcc expects it to be defined by a global variable called
9
- * "__stack_chk_guard" on ARM. This unfortunately means that on SMP
10
- * we cannot have a different canary value per task.
9
+ * "__stack_chk_guard" on ARM. This prevents SMP systems from using a
10
+ * different value for each task unless we enable a GCC plugin that
11
+ * replaces these symbol references with references to each task's own
12
+ * value.
1113 */
1214
1315 #ifndef _ASM_STACKPROTECTOR_H
....@@ -15,6 +17,8 @@
1517
1618 #include <linux/random.h>
1719 #include <linux/version.h>
20
+
21
+#include <asm/thread_info.h>
1822
1923 extern unsigned long __stack_chk_guard;
2024
....@@ -33,7 +37,11 @@
3337 canary ^= LINUX_VERSION_CODE;
3438
3539 current->stack_canary = canary;
40
+#ifndef CONFIG_STACKPROTECTOR_PER_TASK
3641 __stack_chk_guard = current->stack_canary;
42
+#else
43
+ current_thread_info()->stack_canary = current->stack_canary;
44
+#endif
3745 }
3846
3947 #endif /* _ASM_STACKPROTECTOR_H */