.. | .. |
---|
15 | 15 | |
---|
16 | 16 | #include <linux/random.h> |
---|
17 | 17 | #include <linux/version.h> |
---|
| 18 | +#include <asm/pointer_auth.h> |
---|
18 | 19 | |
---|
19 | 20 | extern unsigned long __stack_chk_guard; |
---|
20 | 21 | |
---|
.. | .. |
---|
26 | 27 | */ |
---|
27 | 28 | static __always_inline void boot_init_stack_canary(void) |
---|
28 | 29 | { |
---|
| 30 | +#if defined(CONFIG_STACKPROTECTOR) |
---|
29 | 31 | unsigned long canary; |
---|
30 | 32 | |
---|
31 | 33 | /* Try to get a semi random initial value. */ |
---|
.. | .. |
---|
34 | 36 | canary &= CANARY_MASK; |
---|
35 | 37 | |
---|
36 | 38 | current->stack_canary = canary; |
---|
37 | | - __stack_chk_guard = current->stack_canary; |
---|
| 39 | + if (!IS_ENABLED(CONFIG_STACKPROTECTOR_PER_TASK)) |
---|
| 40 | + __stack_chk_guard = current->stack_canary; |
---|
| 41 | +#endif |
---|
| 42 | + ptrauth_thread_init_kernel(current); |
---|
| 43 | + ptrauth_thread_switch_kernel(current); |
---|
| 44 | + ptrauth_enable(); |
---|
38 | 45 | } |
---|
39 | 46 | |
---|
40 | 47 | #endif /* _ASM_STACKPROTECTOR_H */ |
---|