]> git.itanic.dy.fi Git - linux-stable/commit
utsname: contribute changes to RNG
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 27 Sep 2022 09:35:16 +0000 (11:35 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 29 Sep 2022 19:37:27 +0000 (21:37 +0200)
commit37608ba315a2b1b548aa5b1064e5559e029cb016
tree8b4b2cd0188f9753c1b35eb0bd1c185bb913237a
parentdd54fd7dfa4574fe350b75a90693dc6552c535e3
utsname: contribute changes to RNG

On some small machines with little entropy, a quasi-unique hostname is
sometimes a relevant factor. I've seen, for example, 8 character
alpha-numeric serial numbers. In addition, the time at which the hostname
is set is usually a decent measurement of how long early boot took. So,
call add_device_randomness() on new hostnames, which feeds its arguments
to the RNG in addition to a fresh cycle counter.

Low cost hooks like this never hurt and can only ever help, and since
this costs basically nothing for an operation that is never a fast path,
this is an overall easy win.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
kernel/sys.c
kernel/utsname_sysctl.c