]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - arch/x86/include/asm/stackprotector.h
Apply preempt_rt patch-4.9-rt1.patch.xz
[zynq/linux.git] / arch / x86 / include / asm / stackprotector.h
index 58505f01962f31f80f2e99c5b0bb9e5b2c8405b8..02fa39652cd6888b4eaf1c601ed554a998ab7ac0 100644 (file)
@@ -59,7 +59,7 @@
  */
 static __always_inline void boot_init_stack_canary(void)
 {
-       u64 canary;
+       u64 uninitialized_var(canary);
        u64 tsc;
 
 #ifdef CONFIG_X86_64
@@ -70,8 +70,15 @@ static __always_inline void boot_init_stack_canary(void)
         * of randomness. The TSC only matters for very early init,
         * there it already has some randomness on most systems. Later
         * on during the bootup the random pool has true entropy too.
+        *
+        * For preempt-rt we need to weaken the randomness a bit, as
+        * we can't call into the random generator from atomic context
+        * due to locking constraints. We just leave canary
+        * uninitialized and use the TSC based randomness on top of it.
         */
+#ifndef CONFIG_PREEMPT_RT_FULL
        get_random_bytes(&canary, sizeof(canary));
+#endif
        tsc = rdtsc();
        canary += tsc + (tsc << 32UL);