History

Merge tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random

Pull random fixes from Ted Ts'o: "In reaction to the fixes to address CVE-2018-1108, some Linux distributions that have certain systemd versions in some cases combined with patches to libcrypt for FIPS/FEDRAMP compliance, have led to boot-time stalls for some hardware. The reaction by some distros and Linux sysadmins has been to install packages that try to do complicated things with the CPU and hope that leads to randomness. To mitigate this, if RDRAND is available, mix it into entropy provided by userspace. It won't hurt, and it will probably help" * tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random: random: mix rdrand with entropy sent in from userspace

Linus Torvalds committed 8 years ago

Commit a26fb012 parents 2ffb57d 81e69df1 file · +9 −1Browse files

Unified · Split

drivers/char/random.c+9−1
@@ -1895,14 +1895,22 @@ static int · 1894 unmodified lines
18951895 write_pool(struct entropy_store *r, const char __user *buffer, size_t count)
18961896 {
18971897 size_t bytes;
1898− __u32 buf[16];
1898+ __u32 t, buf[16];
18991899 const char __user *p = buffer;
19001900
19011901 while (count > 0) {
1902+ int b, i = 0;
1903+
19021904 bytes = min(count, sizeof(buf));
19031905 if (copy_from_user(&buf, p, bytes))
19041906 return -EFAULT;
19051907
1908+ for (b = bytes ; b > 0 ; b -= sizeof(__u32), i++) {
1909+ if (!arch_get_random_int(&t))
1910+ break;
1911+ buf[i] ^= t;
1912+ }
1913+
19061914 count -= bytes;
19071915 p += bytes;
19081916

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