1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef _ASM_RISCV_STACKPROTECTOR_H
4 #define _ASM_RISCV_STACKPROTECTOR_H
6 extern unsigned long __stack_chk_guard;
9 * Initialize the stackprotector canary value.
11 * NOTE: this must only be called from functions that never return,
12 * and it must always be inlined.
14 static __always_inline void boot_init_stack_canary(void)
16 unsigned long canary = get_random_canary();
18 current->stack_canary = canary;
19 if (!IS_ENABLED(CONFIG_STACKPROTECTOR_PER_TASK))
20 __stack_chk_guard = current->stack_canary;
22 #endif /* _ASM_RISCV_STACKPROTECTOR_H */