x86: ascii armor the x86_64 boot init stack canary
PATCH 67/96 x86: ascii armor the x86_64 boot init stack canary
From: Rik van Riel <[email protected]>
Subject: x86: ascii armor the x86_64 boot init stack canary
Use the ascii-armor canary to prevent unterminated C string overflows from being able to successfully overwrite the canary, even if they somehow obtain the canary value.
Inspired by execshield ascii-armor and Daniel Micay's linux-hardened tree.
Signed-off-by Rik van Riel <[email protected]>
Acked-by Kees Cook <[email protected]>
Cc Daniel Micay <[email protected]>
Cc "Theodore Ts'o" <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Yoshinori Sato <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
arch/x86/include/asm/stackprotector.h | 1 + 1 file changed, 1 insertion(+)
arch/x86/include/asm/stackprotector.h renamed from arch/x86/include/asm/stackprotector.h~x86-ascii-armor-the-x86_64-boot-init-stack-canary +1 -0
@@ -74,6 +74,7 @@ static __always_inline void boot_init_stget_random_bytes (&canary,sizeof (canary)); tsc =rdtsc (); canary += tsc + (tsc <<32UL ); + canary &=CANARY_MASK ; current->stack_canary = canary;#ifdef CONFIG_X86_64
_