Commit fb6cc4ac authored by Kees Cook's avatar Kees Cook Committed by Linus Torvalds
Browse files

sh/boot: add static stack-protector to pre-kernel

The sh decompressor code triggers stack-protector code generation when
using CONFIG_CC_STACKPROTECTOR_STRONG.  As done for arm and mips, add a
simple static stack-protector canary.  As this wasn't protected before,
the risk of using a weak canary is minimized.  Once the kernel is
actually up, a better canary is chosen.


Signed-off-by: default avatarKees Cook <>
Cc: Yoshinori Sato <>
Cc: Rich Felker <>
Cc: Al Viro <>
Cc: Ingo Molnar <>
Cc: Laura Abbott <>
Cc: Masahiro Yamada <>
Cc: Michal Marek <>
Cc: Nicholas Piggin <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 868038be
......@@ -104,6 +104,18 @@ static void error(char *x)
while(1); /* Halt */
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");
#define stackalign 8
......@@ -118,6 +130,8 @@ void decompress_kernel(void)
unsigned long output_addr;
output_addr = (CONFIG_MEMORY_START + 0x2000);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment