From: Nick Kossifidis Date: Mon, 17 Dec 2012 03:18:11 +0000 (-0500) Subject: random: Mix cputime from each thread that exits to the pool X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6133705494bb02953e1e2cc3018a4373981b3c97;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git random: Mix cputime from each thread that exits to the pool When a thread exits mix it's cputime (userspace + kernelspace) to the entropy pool. We don't know how "random" this is, so we use add_device_randomness that doesn't mess with entropy count. Signed-off-by: Nick Kossifidis Signed-off-by: Theodore Ts'o --- diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 125cb67daa21..f07827a4e281 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c @@ -9,6 +9,7 @@ #include #include #include +#include /* * Called after updating RLIMIT_CPU to run cpu timer and update @@ -494,6 +495,8 @@ static void cleanup_timers(struct list_head *head, */ void posix_cpu_timers_exit(struct task_struct *tsk) { + add_device_randomness((const void*) &tsk->se.sum_exec_runtime, + sizeof(unsigned long long)); cleanup_timers(tsk->cpu_timers, tsk->utime, tsk->stime, tsk->se.sum_exec_runtime);