Subject: /dev/random problems 1.6_STABLE
To: None <current-users@netbsd.org>
From: Martti Kuparinen <martti.kuparinen@iki.fi>
List: current-users
Date: 12/16/2002 11:14:35
Hi!

Is the random number device (/dev/random) broken in 1.6_STABLE? I have
major problems with my IMAP server, the server simply hangs and
the users experience timeouts as the result (see below).

# uname -a
NetBSD mail.mydomain.com 1.6_STABLE NetBSD 1.6_STABLE (MAIL) #5: Mon Dec 16 08:08:48 CET 2002     root@mail.mydomain.com:/usr/src/sys/arch/i386/compile/MAIL i386

  7969 pop3d    NAMI  "/dev/random"
  7969 pop3d    RET   open 13/0xd
  7969 pop3d    CALL  __fstat13(0xd,0xbfbfd52c)
  7969 pop3d    RET   __fstat13 0
  7969 pop3d    CALL  break(0x809a000)
  7969 pop3d    RET   break 0
  7969 pop3d    CALL  ioctl(0xd,TIOCGETA,0xbfbfd560)
  7969 pop3d    RET   ioctl -1 errno 22 Invalid argument
  7969 pop3d    CALL  read(0xd,0x808a000,0x10000)
  <nothing appears here for several minutes>

If I manually patch cyrus-sasl-1.5.27nb3's acconfig.h and config.h.in to
use /dev/urandom instead of /dev/random everything works fine.

 17915 pop3d    NAMI  "/dev/urandom"
 17915 pop3d    RET   open 13/0xd
 17915 pop3d    CALL  __fstat13(0xd,0xbfbfd52c)
 17915 pop3d    RET   __fstat13 0
 17915 pop3d    CALL  break(0x809a000)
 17915 pop3d    RET   break 0
 17915 pop3d    CALL  ioctl(0xd,TIOCGETA,0xbfbfd560)
 17915 pop3d    RET   ioctl -1 errno 22 Invalid argument
 17915 pop3d    CALL  read(0xd,0x808a000,0x10000)
 17915 pop3d    GIO   fd 13 read 4088 bytes
 ...
  17915 pop3d    RET   read 65536/0x10000
 17915 pop3d    CALL  close(0xd)
 17915 pop3d    RET   close 0
 17915 pop3d    CALL  gettimeofday(0xbfbfd6e4,0)
 17915 pop3d    RET   gettimeofday 0
 17915 pop3d    CALL  select(0x1,0xbfbfb6ac,0,0,0xbfbfb690)
 17915 pop3d    RET   select 0
 17915 pop3d    CALL  write(0x1,0x8080000,0x38)
 17915 pop3d    GIO   fd 1 wrote 56 bytes
       "+OK mail3.verkstad.net Cyrus POP3 v2.0.17 server ready\r
       "

Martti

---
Martti Kuparinen <martti.kuparinen@iki.fi>      NetBSD - No media hype
http://www.iki.fi/kuparine/                     http://www.netbsd.org/