Re: /dev/urandom uses uninit bytes, leaks user data

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Matt Mackall <mpm@...>
Cc: <linux-kernel@...>, <security@...>
Date: Friday, December 14, 2007 - 4:45 pm

Matt Mackall wrote:

The combination of capturing data from other users, plus seeding
the pool with your own data, just might be powerful enough to help
steal secrets, sometime in the next five years, from data that is
recorded today.




Matt is correct.  The rolled-up result follows.

Signed off by: jreiser@BitWagon.com

--- ./drivers/char/random.c.orig	2007-12-14 11:06:03.000000000 -0800
+++ ./drivers/char/random.c	2007-12-14 12:27:23.000000000 -0800
@@ -708,6 +708,8 @@

 		bytes=extract_entropy(r->pull, tmp, bytes,
 				      random_read_wakeup_thresh / 8, rsvd);
+		/* clear uninitialized bytes at the end to make valgrind happy */
+		memset((char *)tmp + bytes, 0, -bytes & 3);
 		add_entropy_words(r, tmp, (bytes + 3) / 4);
 		credit_entropy_store(r, bytes*8);
 	}
-- 
John Reiser, jreiser@BitWagon.com

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: /dev/urandom uses uninit bytes, leaks user data, John Reiser, (Fri Dec 14, 4:45 pm)
Re: /dev/urandom uses uninit bytes, leaks user data, Theodore Tso, (Fri Dec 14, 7:23 pm)
Re: /dev/urandom uses uninit bytes, leaks user data, John Reiser, (Fri Dec 14, 8:30 pm)
Re: /dev/urandom uses uninit bytes, leaks user data, Herbert Xu, (Sat Dec 15, 3:13 am)
Re: /dev/urandom uses uninit bytes, leaks user data, Matt Mackall, (Sat Dec 15, 12:30 pm)