Commit a2854757 authored by Luo Qiu's avatar Luo Qiu Committed by Huacai Chen
Browse files

LoongArch: Use get_random_canary() for stack canary init



Like others, replace the custom stack canary initialization with the
get_random_canary() helper, following the pattern established in commit
622754e8 ("stackprotector: actually use get_random_canary()").

Signed-off-by: default avatarLuo Qiu <luoqiu@kylinsec.com.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 84763495
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -12,9 +12,6 @@
#ifndef _ASM_STACKPROTECTOR_H
#define _ASM_STACKPROTECTOR_H

#include <linux/random.h>
#include <linux/version.h>

extern unsigned long __stack_chk_guard;

/*
@@ -25,11 +22,7 @@ extern unsigned long __stack_chk_guard;
 */
static __always_inline void boot_init_stack_canary(void)
{
	unsigned long canary;

	/* Try to get a semi random initial value. */
	get_random_bytes(&canary, sizeof(canary));
	canary ^= LINUX_VERSION_CODE;
	unsigned long canary = get_random_canary();

	current->stack_canary = canary;
	__stack_chk_guard = current->stack_canary;