public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Subject: Re: /dev/random probs in 2.4test(12-pre3)
Date: 1 Dec 2000 10:18:56 -0800	[thread overview]
Message-ID: <908q2g$1pf$1@cesium.transmeta.com> (raw)
In-Reply-To: <Pine.LNX.4.10.10012011720050.23462-100000@sphinx.mythic-beasts.com>

Followup to:  <Pine.LNX.4.10.10012011720050.23462-100000@sphinx.mythic-beasts.com>
By author:    Matthew Kirkwood <matthew@hairy.beasts.org>
In newsgroup: linux.dev.kernel
>
> Hi,
> 
> It looks like the random driver in 2.4test will return a
> short read, rather than blocking.  This is breaking vpnd
> (http://sunsite.dk/vpnd/) which breaks with "failed to
> gather random data" or similar.
> 
> Here's a sample strace:
> 
> open("/dev/random", O_RDONLY)           = 3
> read(3, "q\321Nu\204\251^\234i\254\350\370\363\"\305\366R\2708V"..., 72) = 29
> close(3)                                = 0
> 
> Have the semantics of the device changed, or is vpnd doing
> something wrong?
> 

vpnd is doing something wrong: it's assuming short reads won't
happen.  /dev/random will block if there is NOTHING to be read;
however, if there are bytes to be read, it will return them even if it
is less than the user asked for.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-12-01 18:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-01 17:26 /dev/random probs in 2.4test(12-pre3) Matthew Kirkwood
2000-12-01 18:18 ` H. Peter Anvin [this message]
2000-12-02 12:01   ` Matthew Kirkwood
  -- strict thread matches above, loose matches on Subject: below --
2000-12-01 17:33 folkert
2000-12-02 11:09 ` Matthew Kirkwood
2000-12-02 18:58   ` Igmar Palsenberg
2000-12-02 18:03     ` Jeff Garzik
2000-12-02 21:32       ` Igmar Palsenberg
2000-12-02 20:42         ` David Ford
2000-12-02 22:00           ` Albert D. Cahalan
2000-12-02 23:18             ` Theodore Y. Ts'o
2000-12-02 23:34               ` Alexander Viro
2000-12-03  3:01                 ` Theodore Y. Ts'o
2000-12-03 12:20                 ` Andrew Morton
2000-12-03 16:32               ` Igmar Palsenberg
2000-12-03  7:20             ` H. Peter Anvin
2000-12-03  7:41               ` Albert D. Cahalan
2000-12-03 16:25           ` Igmar Palsenberg
2000-12-03 18:52             ` Jeff Garzik
2000-12-03 21:18               ` Igmar Palsenberg
2000-12-03 20:15                 ` David Ford
2000-12-03  7:17         ` H. Peter Anvin
2000-12-19 19:24           ` Kai Henningsen
2000-12-02 21:35       ` Igmar Palsenberg
2000-12-02 20:44         ` David Ford
2000-12-03 16:27           ` Igmar Palsenberg
2000-12-03  7:19         ` H. Peter Anvin
2000-12-03  7:16     ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='908q2g$1pf$1@cesium.transmeta.com' \
    --to=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox