5656#include <linux/sched/isolation.h>
5757#include <crypto/chacha.h>
5858#include <crypto/blake2s.h>
59- #ifdef CONFIG_VDSO_GETRANDOM
60- #include <vdso/getrandom.h>
6159#include <vdso/datapage.h>
62- #include <vdso/vsyscall.h>
63- #endif
6460#include <asm/archrandom.h>
6561#include <asm/processor.h>
6662#include <asm/irq.h>
@@ -276,7 +272,7 @@ static void crng_reseed(struct work_struct *work)
276272 if (next_gen == ULONG_MAX )
277273 ++ next_gen ;
278274 WRITE_ONCE (base_crng .generation , next_gen );
279- #ifdef CONFIG_VDSO_GETRANDOM
275+
280276 /* base_crng.generation's invalid value is ULONG_MAX, while
281277 * vdso_k_rng_data->generation's invalid value is 0, so add one to the
282278 * former to arrive at the latter. Use smp_store_release so that this
@@ -290,8 +286,9 @@ static void crng_reseed(struct work_struct *work)
290286 * because the vDSO side only checks whether the value changed, without
291287 * actually using or interpreting the value.
292288 */
293- smp_store_release ((unsigned long * )& vdso_k_rng_data -> generation , next_gen + 1 );
294- #endif
289+ if (IS_ENABLED (CONFIG_VDSO_GETRANDOM ))
290+ smp_store_release ((unsigned long * )& vdso_k_rng_data -> generation , next_gen + 1 );
291+
295292 if (!static_branch_likely (& crng_is_ready ))
296293 crng_init = CRNG_READY ;
297294 spin_unlock_irqrestore (& base_crng .lock , flags );
@@ -744,9 +741,8 @@ static void __cold _credit_init_bits(size_t bits)
744741 if (system_dfl_wq )
745742 queue_work (system_dfl_wq , & set_ready );
746743 atomic_notifier_call_chain (& random_ready_notifier , 0 , NULL );
747- #ifdef CONFIG_VDSO_GETRANDOM
748- WRITE_ONCE (vdso_k_rng_data -> is_ready , true);
749- #endif
744+ if (IS_ENABLED (CONFIG_VDSO_GETRANDOM ))
745+ WRITE_ONCE (vdso_k_rng_data -> is_ready , true);
750746 wake_up_interruptible (& crng_init_wait );
751747 kill_fasync (& fasync , SIGIO , POLL_IN );
752748 pr_notice ("crng init done\n" );
0 commit comments