#8089 NORM 8.2.0 (: /dev/hwrng isn't random.

Zarro Boogs per Child bugtracker at laptop.org
Fri Sep 12 12:08:42 EDT 2008


#8089: /dev/hwrng isn't random.
-----------------------------------+----------------------------------------
   Reporter:  cscott               |       Owner:  cscott                 
       Type:  defect               |      Status:  new                    
   Priority:  normal               |   Milestone:  8.2.0 (was Update.2)   
  Component:  ofw - open firmware  |     Version:  not specified          
 Resolution:                       |    Keywords:  blocks?:8.2.0 cjbfor8.2
Next_action:  qa signoff           |    Verified:  0                      
  Blockedby:                       |    Blocking:  8024                   
-----------------------------------+----------------------------------------

Comment(by cscott):

 Slightly edited IRC transcript:
 {{{
 (11:39:38 AM) CosmicPenguin: can you read a MSR for me really quickly?
 (11:39:48 AM) C. Scott Ananian: um, maybe?
 (11:39:58 AM) CosmicPenguin: 58002006
 [...]
 (11:41:17 AM) C. Scott Ananian: ofw says '0', but I'm not sure I believe
 it
 (11:41:43 AM) C. Scott Ananian: sorry, '3 0'
 (11:41:53 AM) CosmicPenguin: lemme see what that should be
 (11:41:58 AM) C. Scott Ananian: that's the result of '58002006 rdmsr'
 (11:42:12 AM) C. Scott Ananian: which seems to do 'rdmsr; push eax; push
 edx'
 [...]
 (11:43:33 AM) C. Scott Ananian: is there a secret 'cripple the hwrng for
 the convenience of the cia spooks' mode we have to turn off? ;-)
 [...]
 (11:45:56 AM) CosmicPenguin: cscott: that should be 503
 (11:46:18 AM) CosmicPenguin: root at geodelx:/media/net# ./readmsr 0x58002006
 (11:46:21 AM) CosmicPenguin: 58002006: 00000000 00000503
 (11:46:22 AM) C. Scott Ananian: CosmicPenguin: so is this all
 Mitch_Bradley's fault?
 (11:46:32 AM) CosmicPenguin: No - Mitch probably didn't know
 (11:46:40 AM) C. Scott Ananian: aww
 (11:46:50 AM) CosmicPenguin: this isn't set in coreboot either, and
 probably nobody told him
 (11:47:11 AM) CosmicPenguin: I'm not 100% sure that bit 11 should be set,
 but go with that and I'm going to track down the BTS
 (11:47:17 AM) ***C. Scott Ananian speculates on cia conspiracy: no one is
 *supposed* to know =)
 (11:47:40 AM) CosmicPenguin: There are hundreds of MSRs on this system
 (11:47:48 AM) C. Scott Ananian: CosmicPenguin: thanks, can you paste the
 right values into trac #8089 and I'll re-assign it to Mitch?
 (11:47:57 AM) CosmicPenguin: cscott: you should try it first
 (11:48:10 AM) CosmicPenguin: you can set that value in OFW and then boot
 (11:48:25 AM) ***pgf has a really great MSR campstove
 (11:48:43 AM) CosmicPenguin: I am so glad you all find this so amusing
 (11:48:50 AM) dilinger: "my MSR is out of fuel"
 (11:48:55 AM) C. Scott Ananian: hmm, 'see wrmsr' says 'pop ecx; pop edx;
 pop eax; wrmsr'
 (11:49:16 AM) C. Scott Ananian: any chance you know what order i should
 put the 58002006, the 00000000, and the 00000503?
 [...]
 (11:51:48 AM) C. Scott Ananian: er, almost.  the winner is 503 0 58002006
 wrmsr
 (11:51:53 AM) CosmicPenguin: Confirmed - 5 is the right nibble there
 (11:52:19 AM) CosmicPenguin: "The RNG default state is with Noise, LFSR
 and Whitener disabled. In this state
 (11:52:22 AM) CosmicPenguin: the output is obviously not random. (many
 long strings of As and 5s)"
 (11:52:32 AM) C. Scott Ananian: CosmicPenguin: yes, that is certainly what
 i see
 (11:52:55 AM) CosmicPenguin: Dear people, this is why PRS is a good idea,
 kthxbye
 (11:53:04 AM) C. Scott Ananian: PRS?
 (11:53:09 AM) CosmicPenguin: preferred register settings
 (11:53:13 AM) C. Scott Ananian: ah
 (11:53:21 AM) CosmicPenguin: We make a list of what all the registers in
 the whole system should be
 (11:53:22 AM) C. Scott Ananian: i'm chalking this up to a win for our
 automated tinderbox
 (11:53:34 AM) C. Scott Ananian: which reported the impossible happening,
 starting yesterday or so
 (11:54:29 AM) CosmicPenguin: Nice of the kernel to vet the results for us
 (11:54:43 AM) C. Scott Ananian: it's *dilinger's* fault!  i knew someone
 was to blame!
 (11:55:47 AM) dilinger: ok, i'll add a patch that causes the kernel to not
 boot if we ever see anything wrong w/ the RNG
 (11:56:00 AM) dilinger: take *that*, tinderbox!
 (11:56:51 AM) C. Scott Ananian: CosmicPenguin: confirmed: *much* more
 uniform histogram, thx.
 (11:56:59 AM) CosmicPenguin: excellent
 (12:00:36 PM) CosmicPenguin: Sounds like your histrogram program might
 find a home on the tinderbox.. :)
 (12:02:35 PM) C. Scott Ananian: CosmicPenguin: the tinderbox already has
 'python -c 'print "\n".join("%d" % ord(x) for x in open("/dev/hwrng").
 read(256))' | sort | uniq -c | wc -l '
 (12:02:47 PM) C. Scott Ananian: and checks that at least 64 unique numbers
 were generated
 (12:03:02 PM) C. Scott Ananian: i added that after the original 'all 0xff
 from the hwrng' debacle
 (12:03:06 PM) C. Scott Ananian: and it's what caught this one
 (12:03:14 PM) CosmicPenguin: nice
 (12:03:24 PM) CosmicPenguin: regression testing - what a concept
 }}}

 So, in summary: OFW should set MSR 58002006 to 00000000.00000503

 That makes our hwrng, you know, like, *random*.

-- 
Ticket URL: <http://dev.laptop.org/ticket/8089#comment:22>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list