arm64: ascii armor the arm64 boot init stack canary
PATCH 68/96 arm64: ascii armor the arm64 boot init stack canary
From: Rik van Riel <[email protected]>
Subject: arm64: ascii armor the arm64 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/arm64/include/asm/stackprotector.h | 1 + 1 file changed, 1 insertion(+)
arch/arm64/include/asm/stackprotector.h renamed from arch/arm64/include/asm/stackprotector.h~arm64-ascii-armor-the-arm64-boot-init-stack-canary +1 -0
@@ -30,6 +30,7 @@ static __always_inline void boot_init_st/* Try to get a semi random initial value. */ get_random_bytes (&canary,sizeof (canary)); canary ^=LINUX_VERSION_CODE ; + canary &=CANARY_MASK ; current->stack_canary = canary; __stack_chk_guard = current->stack_canary;
_