提交 61337054 编写于 作者: N Nick Kossifidis 提交者: Theodore Ts'o

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: NNick Kossifidis <mickflemm@gmail.com>
Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
上级 ec8f02da
......@@ -9,6 +9,7 @@
#include <asm/uaccess.h>
#include <linux/kernel_stat.h>
#include <trace/events/timer.h>
#include <linux/random.h>
/*
* 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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册