Since add_vmfork_randomness() is only called from vmgenid.o, we can guard it in CONFIG_VMGENID, similarly to how we do with add_disk_randomness() and CONFIG_BLOCK. If we ever have multiple things calling into add_vmfork_randomness(), we can add another shared Kconfig symbol for that, but for now, this is good enough. Even though add_vmfork_randomess() is a pretty small function, removing it means that there are only calls to crng_reseed(false) and none to crng_reseed(true), which means the compiler can constant propagate the false, removing branches from crng_reseed() and its descendants. Additionally, we don't even need the symbol to be exported if CONFIG_VMGENID is not a module, so conditionalize that too.
Showing the changes to include (1 of 2 files). Show all
Unified · Split
| @@ -34,7 +34,9 @@ extern void add_input_randomness(unsigned int type, unsigned int code, · 33 unmodified lines | ||
| 34 | 34 | extern void add_interrupt_randomness(int irq) __latent_entropy; |
| 35 | 35 | extern void add_hwgenerator_randomness(const void *buffer, size_t count, |
| 36 | 36 | size_t entropy); |
| 37 | +#if IS_ENABLED(CONFIG_VMGENID) | |
| 37 | 38 | extern void add_vmfork_randomness(const void *unique_vm_id, size_t size); |
| 39 | +#endif | |
| 38 | 40 | |
| 39 | 41 | extern void get_random_bytes(void *buf, size_t nbytes); |
| 40 | 42 | extern int wait_for_random_bytes(void); |