diff options
author | Nick Kossifidis <mickflemm@gmail.com> | 2012-12-16 22:18:11 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-12-16 22:18:11 -0500 |
commit | 6133705494bb02953e1e2cc3018a4373981b3c97 (patch) | |
tree | 4c46ef0c3b1c6a3b07a7f98fda0873c4f201934c /kernel | |
parent | ec8f02da9ea500474417d1d31fa3d46a562ab366 (diff) |
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 <mickflemm@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/posix-cpu-timers.c | 3 |
1 files changed, 3 insertions, 0 deletions
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 @@ | |||
9 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
10 | #include <linux/kernel_stat.h> | 10 | #include <linux/kernel_stat.h> |
11 | #include <trace/events/timer.h> | 11 | #include <trace/events/timer.h> |
12 | #include <linux/random.h> | ||
12 | 13 | ||
13 | /* | 14 | /* |
14 | * Called after updating RLIMIT_CPU to run cpu timer and update | 15 | * Called after updating RLIMIT_CPU to run cpu timer and update |
@@ -494,6 +495,8 @@ static void cleanup_timers(struct list_head *head, | |||
494 | */ | 495 | */ |
495 | void posix_cpu_timers_exit(struct task_struct *tsk) | 496 | void posix_cpu_timers_exit(struct task_struct *tsk) |
496 | { | 497 | { |
498 | add_device_randomness((const void*) &tsk->se.sum_exec_runtime, | ||
499 | sizeof(unsigned long long)); | ||
497 | cleanup_timers(tsk->cpu_timers, | 500 | cleanup_timers(tsk->cpu_timers, |
498 | tsk->utime, tsk->stime, tsk->se.sum_exec_runtime); | 501 | tsk->utime, tsk->stime, tsk->se.sum_exec_runtime); |
499 | 502 | ||