| .. | .. |
|---|
| 65 | 65 | */ |
|---|
| 66 | 66 | static __always_inline void boot_init_stack_canary(void) |
|---|
| 67 | 67 | { |
|---|
| 68 | | - u64 canary; |
|---|
| 68 | + u64 uninitialized_var(canary); |
|---|
| 69 | 69 | u64 tsc; |
|---|
| 70 | 70 | |
|---|
| 71 | 71 | #ifdef CONFIG_X86_64 |
|---|
| .. | .. |
|---|
| 76 | 76 | * of randomness. The TSC only matters for very early init, |
|---|
| 77 | 77 | * there it already has some randomness on most systems. Later |
|---|
| 78 | 78 | * on during the bootup the random pool has true entropy too. |
|---|
| 79 | + * For preempt-rt we need to weaken the randomness a bit, as |
|---|
| 80 | + * we can't call into the random generator from atomic context |
|---|
| 81 | + * due to locking constraints. We just leave canary |
|---|
| 82 | + * uninitialized and use the TSC based randomness on top of it. |
|---|
| 79 | 83 | */ |
|---|
| 84 | +#ifndef CONFIG_PREEMPT_RT_FULL |
|---|
| 80 | 85 | get_random_bytes(&canary, sizeof(canary)); |
|---|
| 86 | +#endif |
|---|
| 81 | 87 | tsc = rdtsc(); |
|---|
| 82 | 88 | canary += tsc + (tsc << 32UL); |
|---|
| 83 | 89 | canary &= CANARY_MASK; |
|---|