From owner-svn-src-all@FreeBSD.ORG Wed Apr 3 07:31:47 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D9B503A3 for ; Wed, 3 Apr 2013 07:31:47 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx1.freebsd.org (Postfix) with ESMTP id 630189C4 for ; Wed, 3 Apr 2013 07:31:46 +0000 (UTC) Received: by mail-lb0-f173.google.com with SMTP id w20so1288406lbh.32 for ; Wed, 03 Apr 2013 00:31:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding:x-gm-message-state; bh=suWjH/TiuR7QjYBAukLXO3bL0C9DTgbvXi+nWPEH/tI=; b=RpSUnhWXuEv9/Cl/liKpFMcKsOmybz4dY4IXwqn/wC5Yo8x0uF6inRJJhIgdQEewb7 09apYLnhCusHK/pQXCfZxdFQ9l+AjgzzWO5wpnwSO1qlkgDnrzHptBpQMG/Y4e1w99gA WbZtO+9Xs8sCfXU7QwTEIIZUaensBXxrvu2EUE8EwyI77gITX3MPCHvCd6ssb14Q1B3o cafJZpfJrYNLzSS8fSd7xyzvbJ5rZiGQo4Ej0Cws4IVvkCMs5ULf8h/9ZheVPx8QpwAD EtigPqasnz27EwbbjoZ0FvunrzWplGsuz2s2gwGvrG8SY3Td8ds6HdkEiUwqnHy75dL5 k41w== X-Received: by 10.152.133.133 with SMTP id pc5mr304104lab.32.1364974305643; Wed, 03 Apr 2013 00:31:45 -0700 (PDT) Received: from [192.168.1.2] ([89.169.163.3]) by mx.google.com with ESMTPS id m9sm359385lbm.3.2013.04.03.00.31.44 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 00:31:44 -0700 (PDT) Message-ID: <515BDADF.8060303@freebsd.org> Date: Wed, 03 Apr 2013 11:31:43 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Bruce Evans Subject: Re: svn commit: r249035 - head/lib/libc/stdlib References: <201304022341.r32NfL8L096954@svn.freebsd.org> <20130403165736.F819@besplex.bde.org> In-Reply-To: <20130403165736.F819@besplex.bde.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlSLGTu4Qe2k6YgEzzB6mWwkEBrUBhckF/X7OMYuo7Bb1ssHpMazaDqOjqus7wJ4ki/Slfn Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2013 07:31:47 -0000 On 03.04.2013 11:04, Bruce Evans wrote: >> + mib[0] = CTL_KERN; >> + mib[1] = KERN_ARND; >> + sysctl(mib, 2, (void *)&next, &len, NULL, 0); >> } > > The sysctl() is certain to fail on old kernels (like open of /dev/random > on even older kernels), but there is no longer any error checking or > handling. The contents of `next' on error is indeterminate (not documented > in the man page), but is probably unchanged. Applications can actually > detect this error although though the API doesn't support this, by > using the documented implementation details and assuming that errno > is properly left changed if the syscall fails (set errno to 0 before > the call here and check it after). Even in case sysctl is not fail, kernel's arc4 is very poorly initialized right after the boot. See the comment in the libkern/arc4random.c arc4_randomstir(), it is about device not loaded case, but it is the same even if device is loaded but not harvest enough. NetBSD implementation of kernel's arc4 is different from ours. Really I am _very_ tired to tell people about the problem, to write patches for the problem, etc., so anybody who are interested can search more details and patches in the mail archives.