Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef _ASM_RISCV_STACKPROTECTOR_H
4#define _ASM_RISCV_STACKPROTECTOR_H
5
6extern unsigned long __stack_chk_guard;
7
8/*
9 * Initialize the stackprotector canary value.
10 *
11 * NOTE: this must only be called from functions that never return,
12 * and it must always be inlined.
13 */
14static __always_inline void boot_init_stack_canary(void)
15{
16 unsigned long canary = get_random_canary();
17
18 current->stack_canary = canary;
19 if (!IS_ENABLED(CONFIG_STACKPROTECTOR_PER_TASK))
20 __stack_chk_guard = current->stack_canary;
21}
22#endif /* _ASM_RISCV_STACKPROTECTOR_H */