From owner-svn-src-head@freebsd.org Tue Sep 3 14:07:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02A6CDD308; Tue, 3 Sep 2019 14:07:01 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N8043qpWz4Q8Q; Tue, 3 Sep 2019 14:07:00 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 080F31AF5F; Tue, 3 Sep 2019 14:06:26 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id DE9A213B4F; Wed, 17 Apr 2019 17:08:40 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBFA89015; Wed, 17 Apr 2019 17:08:40 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0F06213AE4; Wed, 17 Apr 2019 17:08:40 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id B036A13ADB for ; Wed, 17 Apr 2019 17:08:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 68D5989006 for ; Wed, 17 Apr 2019 17:08:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x843.google.com with SMTP id v32so28157121qtc.10 for ; Wed, 17 Apr 2019 10:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z4gCfGlS9QARz41t/La0ab7tehoJuA69FZHemKOFdGc=; b=hrzMQr6cbzQ8lFAjd9t0Ku9BG4SZuO2D7JW2A6ANBrrREeJ2o8xd8dTph5Brx3AcnH gkZZqb6uXvLly92zzFM4uKZGHPgUwWpD68NVBvpS+0lb/eB9kaCneLjTT5cg36tGBmma iYFMq5+71aUiShoKn3R1dQs4dTZDSaA8+l+kExXWEoXxyvl0k6p2gmFaF60qsHf6rSJy 3dqTw1niIhi6bDSBSi/zD/SXGVSsYUhaW6x1xXQgl/Xvu2yBvPWMHm1hr1yMOGdrw9ni m8o1237AMZVY85ccaaILLu0tqaXNUK6orl4fw92K80okzntM0AxApab8GZ9DRLQaUkq0 sa5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z4gCfGlS9QARz41t/La0ab7tehoJuA69FZHemKOFdGc=; b=EGoQIs0JgIIdnLS50kpW3HxQF5RWGAfnGsAGLkcwrG/3i/TY39ssXwD5y42AoMk51p xccbum5VcqPRUWXCHgjFwt4YT3GppPu6JMMDXQ5FzKxqWgPir8oOi+6HaW1lUwgmi6xD UO2WksJveAWUOIPA9djYMcUFxxtkm3rtcKGLP4DqGgAuBVuHfmMpaXavMWGnntgIRFO+ fUk2Nqs7ssGXFegSeEmgPt7rNixOx2NMQoU35S5Exv/FOyMEGLZiDBMjfn2NqlFrjR3G fHWJqCZ5Y34Z4RHhsNOJeLs/4N2rfIgt1moK3WUxbl37kwM3sq1XOUQkE9FGY3W5jQep Gnvw== X-Gm-Message-State: APjAAAXDWYT2wMBxZZtvLx1ef3KpyFP/KBgeXdscGdhgoKsgA6p6nBcY 511rqYfqM1LKaDxD0tHaOdunRP9M4X+9yPOln2xZtw== X-Google-Smtp-Source: APXvYqzuDK4jeVWGx82V/3dwSHv5C8VKVsDboGNIyN9AAUB3Jufibgstu+rIuEZoXgJW46ZYoFrL3QgdiIlSCEpeeec= X-Received: by 2002:ac8:4685:: with SMTP id g5mr72658930qto.242.1555520916889; Wed, 17 Apr 2019 10:08:36 -0700 (PDT) MIME-Version: 1.0 References: <457a2c63-f062-8fc6-15d4-6f5b93981930@FreeBSD.org> <201904162251.x3GMp2aF097103@gndrsh.dnsmgr.net> In-Reply-To: <201904162251.x3GMp2aF097103@gndrsh.dnsmgr.net> From: Warner Losh Message-ID: Subject: Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys To: "Rodney W. Grimes" Cc: John Baldwin , "Conrad E. Meyer" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 4FBFA89015 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.989,0] Status: O Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:07:15 -0000 X-Original-Date: Wed, 17 Apr 2019 11:08:24 -0600 X-List-Received-Date: Tue, 03 Sep 2019 14:07:15 -0000 On Tue, Apr 16, 2019, 4:51 PM Rodney W. Grimes wrote: > > On 4/15/19 11:40 AM, Conrad Meyer wrote: > > > Author: cem > > > Date: Mon Apr 15 18:40:36 2019 > > > New Revision: 346250 > > > URL: https://svnweb.freebsd.org/changeset/base/346250 > > > > > > Log: > > > random(4): Block read_random(9) on initial seeding > > > > > > read_random() is/was used, mostly without error checking, in a lot of > > > very sensitive places in the kernel -- including seeding the widely > used > > > arc4random(9). > > > > > > Most uses, especially arc4random(9), should block until the device > is seeded > > > rather than proceeding with a bogus or empty seed. I did not spy any > > > obvious kernel consumers where blocking would be inappropriate (in > the > > > sense that lack of entropy would be ok -- I did not investigate > locking > > > angle thoroughly). In many instances, arc4random_buf(9) or that > family > > > of APIs would be more appropriate anyway; that work was done in > r345865. > > > > There are definitely places arc4random is used where sleeping is not > allowed. > > ipsec generating nonces for AES-CBC is one example I can think of off the > > top of my head. I think it might be useful to add an explicit > WITNESS_WARN > > in arc4random to catch these cases so they can be found and reasoned > about. > > > > > This change primarily impacts the behavior of /dev/random on embedded > > > systems with read-only media that do not configure "nodevice > random". We > > > toggle the default from 'charge on blindly with no entropy' to 'block > > > indefinitely.' This default is safer, but may cause frustration. > Embedded > > > system designers using FreeBSD have several options. The most > obvious is to > > > plan to have a small writable NVRAM or NAND to persist entropy, like > larger > > > systems. Early entropy can be fed from any loader, or by writing > directly > > > to /dev/random during boot. Some embedded SoCs now provide a fast > hardware > > > entropy source; this would also work for quickly seeding Fortuna. A > 3rd > > > option would be creating an embedded-specific, more simplistic random > > > module, like that designed by DJB in [1] (this design still requires > a small > > > rewritable media for forward secrecy). Finally, the least preferred > option > > > might be "nodevice random", although I plan to remove this in a > subsequent > > > revision. > > > > Note that I actually often run into unseeded systems when doing > development > > using qemu for non-x86 architectures. For example, when booting mips > from > > qemu, there is no loader, the kernel just starts, and since the endian is > > opposite, I frequently regenerate the filesystem using makefs. > > Isnt this also the case for bhyveload? We do not go through the loader > there when we are starting a FreeBSD guest, correct? > Bhyveload is a copy of the boot loader and runs userboot to make it happen. Warner > John Baldwin > -- > Rod Grimes > rgrimes@freebsd.org > >