NetBSD Problem Report #17997

Received: (qmail 1954 invoked by uid 605); 19 Aug 2002 23:41:38 -0000
Message-Id: <20020819234136.05AF911124@narn.netbsd.org>
Date: Mon, 19 Aug 2002 16:41:36 -0700 (PDT)
From: ChristianBiere@gmx.de
Sender: gnats-bugs-owner@netbsd.org
Reply-To: ChristianBiere@gmx.de
To: gnats-bugs@gnats.netbsd.org
Subject: RND_COM still broken on i386?
X-Send-Pr-Version: www-1.0

>Number:         17997
>Category:       kern
>Synopsis:       RND_COM still broken on i386?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 19 23:42:00 +0000 2002
>Closed-Date:    
>Last-Modified:  Wed May 07 08:20:37 +0000 2003
>Originator:     Christian Biere
>Release:        1.6_BETA4
>Organization:
>Environment:
>Description:
from "/sys/arch/i386/conf/GENERIC":

# rnd works; RND_COM does not on port i386 yet.
pseudo-device   rnd                     # /dev/random and in-kernel generator
#options        RND_COM                 # use "com" randomness as well (BROKEN)

I've tested RND_COM and so far it seems to work:
Source                 Bits Type      Flags
fd0                       0 disk estimate, collect
pms0                      0 tty  estimate, collect
pckbd0                33719 tty  estimate, collect
com1                   7373 tty  estimate, collect
com0                 222519 tty  estimate, collect
sip0                 293277 net  estimate, collect
cd1                  129278 disk estimate, collect
cd0                  215167 disk estimate, collect
wd0                 2305379 disk estimate, collect

The only strange thing I notice is: The timer is extra ordinary
high but that might be normal with a RS232. BTW, the device at com0
is a mouse, at com1 is serial console (reserved for kernel crashes).

I've also noticed that moving the mouse doesn't increase the counter
as long as I'm not at a X vt or doing e.g. "less -f /dev/tty0".
When moving the mouse then the bit timer for com0 increases upto
several hundred bits per second.

So my question is: Is gathering random from com0 still broken and
if yes: in which way? I've found no documentation about this problem.
The kernel option RND_COM was added 1997 with changes in
"/sys/dev/ic/com.c".

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:

From: itojun@iijlab.net
To: ChristianBiere@gmx.de
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/17997: RND_COM still broken on i386? 
Date: Tue, 20 Aug 2002 08:52:29 +0900

 >The only strange thing I notice is: The timer is extra ordinary
 >high but that might be normal with a RS232. BTW, the device at com0
 >is a mouse, at com1 is serial console (reserved for kernel crashes).
 >I've also noticed that moving the mouse doesn't increase the counter
 >as long as I'm not at a X vt or doing e.g. "less -f /dev/tty0".
 >When moving the mouse then the bit timer for com0 increases upto
 >several hundred bits per second.

 	i fail to see why you take it as a bug.  when there's no mouse
 	motion, there's no data output towards com0, hence no entropy
 	can be gathered.  when mouse is in motion, it will emit 3 to 5 bytes
 	on every move you make (try something like "od -x /dev/tty00" and
 	move your mouse).

 itojun

From: Jason R Thorpe <thorpej@wasabisystems.com>
To: ChristianBiere@gmx.de
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/17997: RND_COM still broken on i386?
Date: Mon, 19 Aug 2002 17:10:51 -0700

 On Mon, Aug 19, 2002 at 04:41:36PM -0700, ChristianBiere@gmx.de wrote:

  > I've tested RND_COM and so far it seems to work:
  > Source                 Bits Type      Flags
  > fd0                       0 disk estimate, collect
  > pms0                      0 tty  estimate, collect
  > pckbd0                33719 tty  estimate, collect
  > com1                   7373 tty  estimate, collect
  > com0                 222519 tty  estimate, collect
  > sip0                 293277 net  estimate, collect
  > cd1                  129278 disk estimate, collect
  > cd0                  215167 disk estimate, collect
  > wd0                 2305379 disk estimate, collect

 It "works", but you're very lucky that it does -- splhigh() does not block
 the serial port interrupt on the i386, which could cause you to have a kernel
 crash if an interrupt happens at just the right moment, because RND expects
 that splhigh() blocks *all* interrupts.

 -- 
         -- Jason R. Thorpe <thorpej@wasabisystems.com>

From: Christian Biere <christianbiere@gmx.de>
To: itojun@iijlab.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/17997: RND_COM still broken on i386?
Date: Tue, 20 Aug 2002 02:30:02 +0200

 itojun@iijlab.net wrote:

 > >The only strange thing I notice is: The timer is extra ordinary
 > >high

 (dot) Only this was considered "strange". I haven't expressed that very
 well. Sorry.

 > >I've also noticed that moving the mouse doesn't increase the counter
 > >as long as I'm not at a X vt or doing e.g. "less -f /dev/tty0".
 > >When moving the mouse then the bit timer for com0 increases upto
 > >several hundred bits per second.
 > 
 > 	i fail to see why you take it as a bug.  when there's no mouse
 > 	motion, there's no data output towards com0, hence no entropy
 > 	can be gathered.

 True that but there must be a consumer (like X, less, od) otherwise there
 won't be any bits collected. IIRC you can disable IRQs on the UART chip
 itself and this might be the reason. Even X in the background and wscons
 in the foreground doesn't help.

From: itojun@iijlab.net
To: Christian Biere <christianbiere@gmx.de>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/17997: RND_COM still broken on i386? 
Date: Tue, 20 Aug 2002 09:38:22 +0900

 >True that but there must be a consumer (like X, less, od) otherwise there
 >won't be any bits collected. IIRC you can disable IRQs on the UART chip
 >itself and this might be the reason. Even X in the background and wscons
 >in the foreground doesn't help.

 	see sys/dev/ic/com.c.  it gathers entropy only when there's consumer.
 	(check call to rnd_add_uint32)

 itojun
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.