NetBSD Problem Report #48531
From www@NetBSD.org Fri Jan 17 14:43:45 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 4F114A647A
for <gnats-bugs@gnats.NetBSD.org>; Fri, 17 Jan 2014 14:43:45 +0000 (UTC)
Message-Id: <20140117144344.13F72A6486@mollari.NetBSD.org>
Date: Fri, 17 Jan 2014 14:43:44 +0000 (UTC)
From: pooka@iki.fi
Reply-To: pooka@iki.fi
To: gnats-bugs@NetBSD.org
Subject: rnd_getmore bit/byte confusion
X-Send-Pr-Version: www-1.0
>Number: 48531
>Category: kern
>Synopsis: rnd_getmore bit/byte confusion
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 17 14:45:00 +0000 2014
>Closed-Date: Tue Mar 26 02:21:46 +0000 2024
>Last-Modified: Tue Mar 26 02:21:46 +0000 2024
>Originator: pooka@iki.fi
>Release:
>Organization:
>Environment:
>Description:
rnd_getmore(RND_POOLBITS - entropy_count * 8);
So that's [bits - 8*bits], and rnd_getmore() seems to want bytes.
>How-To-Repeat:
>Fix:
Guessing this was intended, but I'm having trouble keeping track of bits/bytes in that code, so someone who understands the code please check:
Index: kern_rndq.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_rndq.c,v
retrieving revision 1.21
diff -u -r1.21 kern_rndq.c
--- kern_rndq.c 29 Aug 2013 01:04:49 -0000 1.21
+++ kern_rndq.c 17 Jan 2014 14:33:30 -0000
@@ -1033,7 +1033,7 @@
#endif
entropy_count = rndpool_get_entropy_count(&rnd_pool);
if (entropy_count < (RND_ENTROPY_THRESHOLD * 2 + len) * 8) {
- rnd_getmore(RND_POOLBITS - entropy_count * 8);
+ rnd_getmore((RND_POOLBITS - entropy_count) / 8);
}
return rndpool_extract_data(&rnd_pool, p, len, flags);
}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 26 Mar 2024 02:21:46 +0000
State-Changed-Why:
fixed in kern_rndq.c 1.22 over a decade ago
(plus this code is now all defunct as of 10)
>Unformatted:
(Contact us)
$NetBSD: gnats-precook-prs,v 1.4 2018/12/21 14:20:20 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.