History

random: do not export add_vmfork_randomness() unless needed

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.

Jason A. Donenfeld committed 4 years ago

Commit a4107d31 parent af6b54e2 files · +6 −0Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/random.h+2−0
@@ -34,7 +34,9 @@ extern void add_input_randomness(unsigned int type, unsigned int code, · 33 unmodified lines
34extern void add_interrupt_randomness(int irq) __latent_entropy;34extern void add_interrupt_randomness(int irq) __latent_entropy;
35extern void add_hwgenerator_randomness(const void *buffer, size_t count,35extern void add_hwgenerator_randomness(const void *buffer, size_t count,
36 size_t entropy);36 size_t entropy);
37#if IS_ENABLED(CONFIG_VMGENID)
37extern void add_vmfork_randomness(const void *unique_vm_id, size_t size);38extern void add_vmfork_randomness(const void *unique_vm_id, size_t size);
39#endif
38 40
39extern void get_random_bytes(void *buf, size_t nbytes);41extern void get_random_bytes(void *buf, size_t nbytes);
40extern int wait_for_random_bytes(void);42extern int wait_for_random_bytes(void);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t