From owner-svn-src-head@FreeBSD.ORG Wed Apr 3 07:31:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 621EE3A2 for ; Wed, 3 Apr 2013 07:31:47 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com [IPv6:2a00:1450:4010:c03::22d]) by mx1.freebsd.org (Postfix) with ESMTP id DC6E89C3 for ; Wed, 3 Apr 2013 07:31:46 +0000 (UTC) Received: by mail-la0-f45.google.com with SMTP id er20so1153896lab.18 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=m1dbAjtRmHowIfoevEdbMgjW1GrOgUptvm6A3MJc6S7Y9dq/efjMOHTcC5lZYNBWjq DJe8KyZYFZRyi9KzZpqZtW8oSpCK+UBoasmlglMQWK4cByWnf/HlJZwotRDVSv7KWX4u RjtRx6xurWQCWfH/CsyERFEqHAD33Hs8WrUPgVbiXBw7NWV682C31B91r4AV+J7vbzhp 7XkNKUEJ6VhagaH8ikeX9DjqiOXShhrWMqTEffeSVjJj0eMB78Wny8p+rppCGTKYXvUy qJ4+l77+AJKl0ynBvu9XTcUXJGoYwUEe06JXXa85JiU63CvayyAWbDKWkYrjzqZ9jqrU 2Khg== 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: ALoCoQnE9mlcInoUBvRdCFxK1HdTB7D5X+HrSGqK/2/4JnxFeQFzUrsdVkbTRY/6IcM+D1/fzX5t Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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.