aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2014-06-24 19:00:17 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-08-01 18:06:46 -0400
commit3b628cac65fa57fe7d948b9b24b9731cab7dd44f (patch)
treeaada423e07f4484b7b4848996a802ed4eccb89f4
parent0d6b614ad75c211bdeb439b8d9f0d4dcefe082d9 (diff)
MIPS: ZBOOT: implement stack protector in compressed boot phase
This patch implements the stack protector code in MIPS compressed boot phase based on the same code added to arm in commit 8779657d29c0ebcc0c94ede4df2f497baf1b563f "stackprotector: Introduce CONFIG_CC_STACKPROTECTOR_STRONG" by Kees Cook <keescook@chromium.org> Signed-off-by: Ben Chan <benchan@chromium.org> Cc: Kees Cook <keescook@chromium.org> Cc: Olof Johansson <olofj@chromium.org> Reviewed-by: Kees Cook <keescook@chromium.org> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/7175/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/boot/compressed/decompress.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index c00c4ddf4514..b49c7adbfa89 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -67,10 +67,24 @@ void error(char *x)
67#include "../../../../lib/decompress_unxz.c" 67#include "../../../../lib/decompress_unxz.c"
68#endif 68#endif
69 69
70unsigned long __stack_chk_guard;
71
72void __stack_chk_guard_setup(void)
73{
74 __stack_chk_guard = 0x000a0dff;
75}
76
77void __stack_chk_fail(void)
78{
79 error("stack-protector: Kernel stack is corrupted\n");
80}
81
70void decompress_kernel(unsigned long boot_heap_start) 82void decompress_kernel(unsigned long boot_heap_start)
71{ 83{
72 unsigned long zimage_start, zimage_size; 84 unsigned long zimage_start, zimage_size;
73 85
86 __stack_chk_guard_setup();
87
74 zimage_start = (unsigned long)(&__image_begin); 88 zimage_start = (unsigned long)(&__image_begin);
75 zimage_size = (unsigned long)(&__image_end) - 89 zimage_size = (unsigned long)(&__image_end) -
76 (unsigned long)(&__image_begin); 90 (unsigned long)(&__image_begin);