{"push_id":836229873,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"2951bf5c6fb3889ee623baba9df25ac32722b4e6","before":"1396570fdca36526dd60a0449d6bafa914038e22","commits":[{"sha":"2951bf5c6fb3889ee623baba9df25ac32722b4e6","author":{"email":"9edab3d8932dbb8f20eb55cd8199c20e7fb56c12@oracle.com","name":"Jeff Liu"},"message":"binfmt_elf.c: use get_random_int() to fix entropy depleting\n\nChanges:\n--------\nv4->v3:\n- s/random_stack_user()/get_atrandom_bytes()/\n- Move this function to ahead of its use to avoid the predeclaration.\n\nv3->v2:\n- Tweak code comments of random_stack_user().\n- Remove redundant bits mask and shift upon the random variable.\n\nv2->v1:\n- Fix random copy to check up buffer length that are not 4-byte multiples.\n\nv3 can be found at:\nhttp://www.spinics.net/lists/linux-fsdevel/msg59597.html\nv2 can be found at:\nhttp://www.spinics.net/lists/linux-fsdevel/msg59418.html\nv1 can be found at:\nhttp://www.spinics.net/lists/linux-fsdevel/msg59128.html\n\nThanks,\n-Jeff\n\nEntropy is quickly depleted under normal operations like ls(1), cat(1),\netc...  between 2.6.30 to current mainline, for instance:\n\n$ cat /proc/sys/kernel/random/entropy_avail\n3428\n$ cat /proc/sys/kernel/random/entropy_avail\n2911\n$cat /proc/sys/kernel/random/entropy_avail\n2620\n\nWe observed this problem has been occurring since 2.6.30 with\nfs/binfmt_elf.c: create_elf_tables()->get_random_bytes(), introduced by\nf06295b44c296c8f (\"ELF: implement AT_RANDOM for glibc PRNG seeding\").\n\n/*\n * Generate 16 random bytes for userspace PRNG seeding.\n */\nget_random_bytes(k_rand_bytes, sizeof(k_rand_bytes));\n\nThe patch introduces a wrapper around get_random_int() which has lower\noverhead than calling get_random_bytes() directly.\n\nWith this patch applied:\n$ cat /proc/sys/kernel/random/entropy_avail\n2731\n$ cat /proc/sys/kernel/random/entropy_avail\n2802\n$ cat /proc/sys/kernel/random/entropy_avail\n2878\n\nAnalyzed by John Sobecki.\n\nSigned-off-by: Jie Liu <jeff.liu@oracle.com>\nCc: Andrew Morton <akpm@linux-foundation.org>\nCc: Al Viro <viro@zeniv.linux.org.uk>\nCc: Andreas Dilger <aedilger@gmail.com>\nCc: Alan Cox <alan@linux.intel.com>\nCc: Arnd Bergmann <arnn@arndb.de>\nCc: John Sobecki <john.sobecki@oracle.com>\nCc: James Morris <james.l.morris@oracle.com>\nCc: Jakub Jelinek <jakub@redhat.com>\nCc: Ted Ts'o <tytso@mit.edu>\nCc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nCc: Kees Cook <keescook@chromium.org>\nCc: Ulrich Drepper <drepper@redhat.com>","distinct":true,"url":"https://api.github.com/repos/dwander/rework/commits/2951bf5c6fb3889ee623baba9df25ac32722b4e6"}]}