Skip to content

Commit

Permalink
MIPS: ZBOOT: implement stack protector in compressed boot phase
Browse files Browse the repository at this point in the history
This patch implements the stack protector code in MIPS compressed boot
phase based on the same code added to arm in commit
8779657 "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>
  • Loading branch information
Ben Chan authored and Ralf Baechle committed Aug 1, 2014
1 parent 0d6b614 commit 3b628ca
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions arch/mips/boot/compressed/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,24 @@ void error(char *x)
#include "../../../../lib/decompress_unxz.c"
#endif

unsigned long __stack_chk_guard;

void __stack_chk_guard_setup(void)
{
__stack_chk_guard = 0x000a0dff;
}

void __stack_chk_fail(void)
{
error("stack-protector: Kernel stack is corrupted\n");
}

void decompress_kernel(unsigned long boot_heap_start)
{
unsigned long zimage_start, zimage_size;

__stack_chk_guard_setup();

zimage_start = (unsigned long)(&__image_begin);
zimage_size = (unsigned long)(&__image_end) -
(unsigned long)(&__image_begin);
Expand Down

0 comments on commit 3b628ca

Please sign in to comment.